diff options
author | Matthew Hoops | 2011-05-11 00:30:02 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-11 00:30:28 -0400 |
commit | a1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch) | |
tree | 8c51419daa486f1d4833757db4715dadab6c3497 /engines/tsage | |
parent | accb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff) | |
parent | 33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff) | |
download | scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2 scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
audio/decoders/qdm2.h
common/util.cpp
engines/groovie/music.cpp
engines/groovie/resource.h
video/qt_decoder.cpp
video/qt_decoder.h
Diffstat (limited to 'engines/tsage')
48 files changed, 4018 insertions, 2923 deletions
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index fd1dfe9e9d..789ec8fa8d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -52,7 +52,10 @@ void SequenceManager::setup() { _sceneObject = _objectList[0]; } -void SequenceManager::synchronise(Serialiser &s) { +void SequenceManager::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + Action::synchronize(s); + s.syncAsSint32LE(_resNum); s.syncAsSint32LE(_sequenceOffset); s.syncAsByte(_keepActive); @@ -150,11 +153,11 @@ void SequenceManager::signal() { case 10: { int resNum= getNextValue(); int lineNum = getNextValue(); - int colour = getNextValue(); + int color = getNextValue(); int xp = getNextValue(); int yp = getNextValue(); int width = getNextValue(); - setMessage(resNum, lineNum, colour, Common::Point(xp, yp), width); + setMessage(resNum, lineNum, color, Common::Point(xp, yp), width); break; } case 11: @@ -181,7 +184,7 @@ void SequenceManager::signal() { break; case 15: v1 = getNextValue(); - _sceneObject->_field7A = v1; + _sceneObject->_moveRate = v1; break; case 16: v1 = getNextValue(); @@ -208,7 +211,7 @@ void SequenceManager::signal() { break; case 22: v1 = getNextValue(); - _sceneObject->setPriority2(v1); + _sceneObject->fixPriority(v1); break; case 23: v1 = getNextValue(); @@ -244,6 +247,7 @@ void SequenceManager::signal() { } case 28: _objectIndex = getNextValue(); + assert((_objectIndex >= 0) && (_objectIndex < 6)); _sceneObject = _objectList[_objectIndex]; assert(_sceneObject); break; @@ -272,14 +276,15 @@ void SequenceManager::signal() { case 34: { v1 = getNextValue(); v2 = getNextValue(); - int objIndex1 = getNextValue(); - int objIndex2 = getNextValue(); - int objIndex3 = getNextValue(); - int objIndex4 = getNextValue(); - int objIndex5 = getNextValue(); + int objIndex1 = getNextValue() - 1; + int objIndex2 = getNextValue() - 1; + int objIndex3 = getNextValue() - 1; + int objIndex4 = getNextValue() - 1; + int objIndex5 = getNextValue() - 1; + int objIndex6 = getNextValue() - 1; setAction(globalManager(), v2 ? this : NULL, v1, _objectList[objIndex1], _objectList[objIndex2], - _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5]); + _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5], _objectList[objIndex6], NULL); break; } default: @@ -294,17 +299,19 @@ void SequenceManager::process(Event &event) { !event.handled && _globals->_sceneObjects->contains(&_sceneText)) { // Remove the text item _sceneText.remove(); + setDelay(2); + event.handled = true; } else { Action::process(event); } } -void SequenceManager::attached(EventHandler *newOwner, EventHandler *fmt, va_list va) { +void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler, va_list va) { // Get the sequence number to use _resNum = va_arg(va, int); - byte *seqData = _vm->_dataManager->getResource(RES_SEQUENCE, _resNum, 0); + byte *seqData = _resourceManager->getResource(RES_SEQUENCE, _resNum, 0); uint seqSize = _vm->_memoryManager.getSize(seqData); _sequenceData.resize(seqSize); @@ -320,12 +327,7 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *fmt, va_lis } setup(); - // TODO: This is not particulary nice, since dummy is uninitialized. - // Since the default Action implementation does not access the va_list - // parameter it should be fine though. Still it would be nice to find - // a better solution to this. - va_list dummy; - Action::attached(newOwner, fmt, dummy); + Action::attached(newOwner, endHandler, va); } /** @@ -337,28 +339,30 @@ uint16 SequenceManager::getNextValue() { return result; } -void SequenceManager::setMessage(int resNum, int lineNum, int colour, const Common::Point &pt, int width) { - _sceneText._colour1 = colour; - _sceneText._colour2 = 0; - _sceneText._colour3 = 0; +void SequenceManager::setMessage(int resNum, int lineNum, int color, const Common::Point &pt, int width) { + _sceneText._color1 = color; + _sceneText._color2 = 0; + _sceneText._color3 = 0; _sceneText._fontNumber = 2; _sceneText._width = width; // Get the display message - Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum); + Common::String msg = _resourceManager->getMessage(resNum, lineNum); - // Get the needed rect, and move it to the desired position - Rect textRect; - _globals->gfxManager().getStringBounds(msg.c_str(), textRect, width); + // Set the text message + _sceneText.setup(msg); + + // Move the text to the correct position + Rect textRect = _sceneText._bounds; Rect sceneBounds = _globals->_sceneManager._scene->_sceneBounds; sceneBounds.collapse(4, 2); textRect.moveTo(pt); textRect.contain(sceneBounds); - // Set the text message - _sceneText.setup(msg); _sceneText.setPosition(Common::Point(textRect.left, textRect.top)); - _sceneText.setPriority2(255); + + // Draw the text + _sceneText.fixPriority(255); _sceneText.show(); // Set the delay based on the number of words @@ -379,8 +383,8 @@ SequenceManager *SequenceManager::globalManager() { /*--------------------------------------------------------------------------*/ ConversationChoiceDialog::ConversationChoiceDialog() { - _stdColour = 23; - _highlightColour = _globals->_scenePalette._colours.background; + _stdColor = 23; + _highlightColor = _globals->_scenePalette._colors.background; _fontNumber = 1; } @@ -443,7 +447,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { if (idx != _selectedIndex) { if (_selectedIndex != _choiceList.size()) { // De-highlight previously selected item - _gfxManager._font._colours.foreground = _stdColour; + _gfxManager._font._colors.foreground = _stdColor; _gfxManager._font.writeLines(_choiceList[_selectedIndex]._msg.c_str(), _choiceList[_selectedIndex]._bounds, ALIGN_LEFT); } @@ -452,7 +456,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { if (_selectedIndex != _choiceList.size()) { // Highlight the new item - _gfxManager._font._colours.foreground = _highlightColour; + _gfxManager._font._colors.foreground = _highlightColor; _gfxManager._font.writeLines(_choiceList[idx]._msg.c_str(), _choiceList[idx]._bounds, ALIGN_LEFT); } @@ -477,7 +481,7 @@ void ConversationChoiceDialog::draw() { drawFrame(); _gfxManager._bounds = tempRect; - _gfxManager._font._colours.foreground = _stdColour; + _gfxManager._font._colors.foreground = _stdColor; _gfxManager.activate(); // Loop through writing the conversation choices @@ -510,12 +514,12 @@ void Obj44::load(const byte *dataP) { _speakerOffset = READ_LE_UINT16(dataP + 0x42); } -void Obj44::synchronise(Serialiser &s) { +void Obj44::synchronize(Serializer &s) { s.syncAsSint32LE(_id); - for (int i = 0; i < OBJ44_LIST_SIZE; ++i) - s.syncAsSint32LE(_field2[i]); - for (int i = 0; i < OBJ44_LIST_SIZE; ++i) - _list[OBJ44_LIST_SIZE].synchronise(s); + for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx) + s.syncAsSint32LE(_field2[idx]); + for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx) + _list[idx].synchronize(s); s.syncAsUint32LE(_speakerOffset); } @@ -535,7 +539,7 @@ void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callb _stripNum = stripNum; _callbackObject = callback; - _sceneNumber = _globals->_sceneManager._sceneNumber; + _sceneNumber = _globals->_sceneManager._scene->_screenNumber; _sceneBounds = _globals->_sceneManager._scene->_sceneBounds; _script.clear(); @@ -547,7 +551,7 @@ void StripManager::reset() { _actionIndex = 0; _delayFrames = 0; _owner = NULL; - _fmt = NULL; + _endHandler = NULL; _field2E6 = false; _stripNum = -1; _obj44Index = 0; @@ -565,7 +569,7 @@ void StripManager::reset() { void StripManager::load() { // Get the script - byte *script = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 2); + byte *script = _resourceManager->getResource(RES_STRIP, _stripNum, 2); uint scriptSize = _vm->_memoryManager.getSize(script); _script.resize(scriptSize); @@ -574,7 +578,7 @@ void StripManager::load() { DEALLOCATE(script); // Get the object list - byte *obj44List = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 1); + byte *obj44List = _resourceManager->getResource(RES_STRIP, _stripNum, 1); int dataSize = _vm->_memoryManager.getSize(obj44List); assert((dataSize % 0x44) == 0); @@ -588,24 +592,27 @@ void StripManager::load() { DEALLOCATE(obj44List); } -void StripManager::synchronise(Serialiser &s) { +void StripManager::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + Action::synchronize(s); + s.syncAsSint32LE(_stripNum); s.syncAsSint32LE(_obj44Index); s.syncAsSint32LE(_field20); s.syncAsSint32LE(_sceneNumber); - _sceneBounds.synchronise(s); + _sceneBounds.synchronize(s); SYNC_POINTER(_activeSpeaker); s.syncAsByte(_textShown); s.syncAsByte(_field2E6); s.syncAsSint32LE(_field2E8); - // Synchronise the item list + // Synchronize the item list int arrSize = _obj44List.size(); s.syncAsUint16LE(arrSize); if (s.isLoading()) _obj44List.resize(arrSize); for (int i = 0; i < arrSize; ++i) - _obj44List[i].synchronise(s); + _obj44List[i].synchronize(s); // Synhcronise script data int scriptSize = _script.size(); @@ -636,7 +643,7 @@ void StripManager::remove() { if (_activeSpeaker) _activeSpeaker->remove(); - if (_sceneNumber != _globals->_sceneManager._scene->_sceneNumber) { + if (_sceneNumber != _globals->_sceneManager._scene->_screenNumber) { _globals->_sceneManager._scene->_sceneBounds = _sceneBounds; _globals->_sceneManager._scene->loadScene(_sceneNumber); } @@ -651,7 +658,7 @@ void StripManager::signal() { } if (_obj44Index < 0) { - EventHandler *owner = _fmt; + EventHandler *owner = _endHandler; int stripNum = ABS(_obj44Index); remove(); @@ -700,7 +707,7 @@ void StripManager::signal() { _activeSpeaker->remove(); _activeSpeaker = speakerP; - if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_sceneNumber != _sceneNumber)) { + if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) { _globals->_sceneManager._scene->_sceneBounds = _sceneBounds; _globals->_sceneManager._scene->loadScene(_sceneNumber); } @@ -736,8 +743,8 @@ void StripManager::process(Event &event) { if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { if (_obj44Index != 10000) { int currIndex = _obj44Index; - while (!_obj44List[_obj44Index + 1]._id) { - _obj44Index = getNewIndex(_obj44List[_obj44Index]._id); + while (!_obj44List[_obj44Index]._list[1]._id) { + _obj44Index = getNewIndex(_obj44List[_obj44Index]._list[0]._id); if ((_obj44Index < 0) || (_obj44Index == 10000)) break; currIndex = _obj44Index; @@ -795,25 +802,28 @@ Speaker::Speaker() : EventHandler() { _textPos = Common::Point(10, 20); _fontNumber = 2; _textMode = ALIGN_LEFT; - _colour1 = _colour2 = _colour3 = _globals->_scenePalette._colours.foreground; + _color1 = _color2 = _color3 = _globals->_scenePalette._colors.foreground; _action = NULL; _speakerName = "SPEAKER"; } -void Speaker::synchronise(Serialiser &s) { - _fieldA.synchronise(s); +void Speaker::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + EventHandler::synchronize(s); + + _fieldA.synchronize(s); SYNC_POINTER(_field18); s.syncString(_speakerName); s.syncAsSint32LE(_newSceneNumber); s.syncAsSint32LE(_oldSceneNumber); - _sceneBounds.synchronise(s); + _sceneBounds.synchronize(s); s.syncAsSint32LE(_textWidth); s.syncAsSint16LE(_textPos.x); s.syncAsSint16LE(_textPos.y); s.syncAsSint32LE(_fontNumber); SYNC_ENUM(_textMode, TextAlign); - s.syncAsSint16LE(_colour1); - s.syncAsSint16LE(_colour2); - s.syncAsSint16LE(_colour3); + s.syncAsSint16LE(_color1); + s.syncAsSint16LE(_color2); + s.syncAsSint16LE(_color3); s.syncAsByte(_hideObjects); } @@ -844,15 +854,15 @@ void Speaker::proc12(Action *action) { void Speaker::setText(const Common::String &msg) { _globals->_sceneObjects->draw(); - _sceneText._colour1 = _colour1; - _sceneText._colour2 = _colour2; - _sceneText._colour3 = _colour3; + _sceneText._color1 = _color1; + _sceneText._color2 = _color2; + _sceneText._color3 = _color3; _sceneText._width = _textWidth; _sceneText._fontNumber = _fontNumber; _sceneText._textMode = _textMode; _sceneText.setup(msg); _sceneText.setPosition(_textPos); - _sceneText.setPriority2(256); + _sceneText.fixPriority(256); // Count the number of words (by spaces) in the string const char *msgP = msg.c_str(); @@ -876,8 +886,8 @@ void Speaker::removeText() { SpeakerGameText::SpeakerGameText() : Speaker() { _speakerName = "GAMETEXT"; _textPos = Common::Point(40, 40); - _textMode = ALIGN_CENTRE; - _colour1 = 7; + _textMode = ALIGN_CENTER; + _color1 = 7; _textWidth = 230; _hideObjects = false; } @@ -886,7 +896,7 @@ SpeakerGameText::SpeakerGameText() : Speaker() { ScreenSpeaker::ScreenSpeaker() : Speaker() { _npc = NULL; - _textMode = ALIGN_CENTRE; + _textMode = ALIGN_CENTER; } void ScreenSpeaker::setText(const Common::String &msg) { @@ -897,9 +907,9 @@ void ScreenSpeaker::setText(const Common::String &msg) { _globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth); if (_npc) { - textRect.centre(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10)); + textRect.center(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10)); } else { - textRect.centre(_globals->_sceneManager._scene->_sceneBounds.left + + textRect.center(_globals->_sceneManager._scene->_sceneBounds.left + (_globals->_sceneManager._scene->_sceneBounds.width() / 2), _globals->_sceneManager._scene->_sceneBounds.top); } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 4d6e51a6b8..f8c5bc7b14 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -40,7 +40,7 @@ class SequenceManager : public Action { private: void setup(); uint16 getNextValue(); - void setMessage(int resNum, int lineNum, int colour, const Common::Point &pt, int width); + void setMessage(int resNum, int lineNum, int color, const Common::Point &pt, int width); SequenceManager *globalManager(); public: SceneText _sceneText; @@ -58,11 +58,11 @@ public: SequenceManager(); virtual Common::String getClassName() { return "SequenceManager"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); virtual void process(Event &event); - virtual void attached(EventHandler *newOwner, EventHandler *fmt, va_list va); + virtual void attached(EventHandler *newOwner, EventHandler *endHandler, va_list va); }; @@ -80,13 +80,13 @@ public: Common::Point _textPos; int _fontNumber; TextAlign _textMode; - int _colour1, _colour2, _colour3; + int _color1, _color2, _color3; bool _hideObjects; public: Speaker(); virtual Common::String getClassName() { return "Speaker"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void remove(); virtual void proc12(Action *action); virtual void setText(const Common::String &msg); @@ -143,19 +143,19 @@ public: class ConversationChoiceDialog : public ModalDialog { public: - int _stdColour; - int _highlightColour; + int _stdColor; + int _highlightColor; int _fontNumber; - int _savedFgColour; + int _savedFgColor; int _savedFontNumber; Common::Array<ChoiceEntry> _choiceList; uint _selectedIndex; public: ConversationChoiceDialog(); - void setColours(int stdColour, int highlightColour) { - _stdColour = stdColour; - _highlightColour = highlightColour; + void setColors(int stdColor, int highlightColor) { + _stdColor = stdColor; + _highlightColor = highlightColor; } void setFontNumber(int fontNum) { _fontNumber = fontNum; } int execute(const Common::StringArray &choiceList); @@ -168,7 +168,7 @@ public: int _id; uint _scriptOffset; - virtual void synchronise(Serialiser &s) { + virtual void synchronize(Serializer &s) { s.syncAsSint32LE(_id); s.syncAsUint32LE(_scriptOffset); } @@ -184,7 +184,7 @@ public: uint _speakerOffset; public: void load(const byte *dataP); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); }; class StripManager : public Action { @@ -212,14 +212,14 @@ public: StripManager(); virtual ~StripManager(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); virtual void process(Event &event); void start(int stripNum, EventHandler *owner, StripCallback *callback = NULL); void setCallback(StripCallback *callback) { _callbackObject = callback; } - void setColours(int stdColour, int highlightColour) { _choiceDialog.setColours(stdColour, highlightColour); } + void setColors(int stdColor, int highlightColor) { _choiceDialog.setColors(stdColor, highlightColor); } void setFontNumber(int fontNum) { _choiceDialog.setFontNumber(fontNum); } void addSpeaker(Speaker *speaker); }; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 81088b4eaa..8ad920e6fd 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -24,10 +24,8 @@ */ #include "common/system.h" -#include "common/config-manager.h" -#include "common/translation.h" #include "engines/engine.h" -#include "gui/saveload.h" +#include "graphics/palette.h" #include "tsage/tsage.h" #include "tsage/core.h" #include "tsage/dialogs.h" @@ -51,7 +49,7 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs // Decode the image for the inventory item to get it's display bounds uint size; - byte *imgData = _vm->_dataManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size); + byte *imgData = _resourceManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size); GfxSurface s = surfaceFromRes(imgData); _bounds = s.getBounds(); @@ -65,87 +63,18 @@ void InvObject::setCursor() { GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum); Graphics::Surface src = s.lockSurface(); - _globals->_events.setCursor(src, s._transColour, s._centroid, _cursorId); + _globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId); } } /*--------------------------------------------------------------------------*/ -InvObjectList::InvObjectList() : - _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."), - _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."), - _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."), - _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."), - _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."), - _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."), - _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."), - _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."), - _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."), - _key(7700, 1, 11, OBJECT_KEY, "A key."), - _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."), - _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."), - _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."), - _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."), - _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."), - _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."), - _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."), - _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."), - _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."), - _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."), - _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."), - _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."), - _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."), - _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."), - _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."), - _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."), - _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."), - _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."), - _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."), - _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."), - _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."), - _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."), - _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") { - - // Add the items to the list - _itemList.push_back(&_stunner); - _itemList.push_back(&_scanner); - _itemList.push_back(&_stasisBox); - _itemList.push_back(&_infoDisk); - _itemList.push_back(&_stasisNegator); - _itemList.push_back(&_keyDevice); - _itemList.push_back(&_medkit); - _itemList.push_back(&_ladder); - _itemList.push_back(&_rope); - _itemList.push_back(&_key); - _itemList.push_back(&_translator); - _itemList.push_back(&_ale); - _itemList.push_back(&_paper); - _itemList.push_back(&_waldos); - _itemList.push_back(&_stasisBox2); - _itemList.push_back(&_ring); - _itemList.push_back(&_cloak); - _itemList.push_back(&_tunic); - _itemList.push_back(&_candle); - _itemList.push_back(&_straw); - _itemList.push_back(&_scimitar); - _itemList.push_back(&_sword); - _itemList.push_back(&_helmet); - _itemList.push_back(&_items); - _itemList.push_back(&_concentrator); - _itemList.push_back(&_nullifier); - _itemList.push_back(&_peg); - _itemList.push_back(&_vial); - _itemList.push_back(&_jacket); - _itemList.push_back(&_tunic2); - _itemList.push_back(&_bone); - _itemList.push_back(&_jar); - _itemList.push_back(&_emptyJar); - +InvObjectList::InvObjectList() { _selectedItem = NULL; } -void InvObjectList::synchronise(Serialiser &s) { - SavedObject::synchronise(s); +void InvObjectList::synchronize(Serializer &s) { + SavedObject::synchronize(s); SYNC_POINTER(_selectedItem); } @@ -155,17 +84,17 @@ void EventHandler::dispatch() { if (_action) _action->dispatch(); } -void EventHandler::setAction(Action *action, EventHandler *fmt, ...) { +void EventHandler::setAction(Action *action, EventHandler *endHandler, ...) { if (_action) { - _action->_fmt = NULL; + _action->_endHandler = NULL; _action->remove(); } _action = action; if (action) { va_list va; - va_start(va, fmt); - _action->attached(this, fmt, va); + va_start(va, endHandler); + _action->attached(this, endHandler, va); va_end(va); } } @@ -175,20 +104,21 @@ void EventHandler::setAction(Action *action, EventHandler *fmt, ...) { Action::Action() { _actionIndex = 0; _owner = NULL; - _fmt = NULL; + _endHandler = NULL; + _attached = false; } -void Action::synchronise(Serialiser &s) { - EventHandler::synchronise(s); - if (s.isLoading()) +void Action::synchronize(Serializer &s) { + EventHandler::synchronize(s); + if (s.getVersion() == 1) remove(); SYNC_POINTER(_owner); s.syncAsSint32LE(_actionIndex); s.syncAsSint32LE(_delayFrames); s.syncAsUint32LE(_startFrame); - s.syncAsSint16LE(_field16); - SYNC_POINTER(_fmt); + s.syncAsByte(_attached); + SYNC_POINTER(_endHandler); } void Action::remove() { @@ -202,9 +132,9 @@ void Action::remove() { _globals->_sceneManager.removeAction(this); } - _field16 = 0; - if (_fmt) - _fmt->signal(); + _attached = false; + if (_endHandler) + _endHandler->signal(); } void Action::process(Event &event) { @@ -230,13 +160,13 @@ void Action::dispatch() { } } -void Action::attached(EventHandler *newOwner, EventHandler *fmt, va_list va) { +void Action::attached(EventHandler *newOwner, EventHandler *endHandler, va_list va) { _actionIndex = 0; _delayFrames = 0; _startFrame = _globals->_events.getFrameNumber(); _owner = newOwner; - _fmt = fmt; - _field16 = 1; + _endHandler = endHandler; + _attached = true; signal(); } @@ -252,15 +182,15 @@ ObjectMover::~ObjectMover() { _sceneObject->_mover = NULL; } -void ObjectMover::synchronise(Serialiser &s) { - EventHandler::synchronise(s); +void ObjectMover::synchronize(Serializer &s) { + EventHandler::synchronize(s); s.syncAsSint16LE(_destPosition.x); s.syncAsSint16LE(_destPosition.y); s.syncAsSint16LE(_moveDelta.x); s.syncAsSint16LE(_moveDelta.y); s.syncAsSint16LE(_moveSign.x); s.syncAsSint16LE(_moveSign.y); s.syncAsSint32LE(_minorDiff); s.syncAsSint32LE(_majorDiff); - s.syncAsSint32LE(_field1A); + s.syncAsSint32LE(_changeCtr); SYNC_POINTER(_action); SYNC_POINTER(_sceneObject); } @@ -294,10 +224,10 @@ void ObjectMover::dispatch() { ySign = _moveSign.y; else { int v = yAmount / yChange; - _field1A += yAmount % yChange; - if (_field1A >= yChange) { + _changeCtr += yAmount % yChange; + if (_changeCtr >= yChange) { ++v; - _field1A -= yChange; + _changeCtr -= yChange; } ySign = _moveSign.y * v; @@ -320,10 +250,10 @@ void ObjectMover::dispatch() { xSign = _moveSign.x; else { int v = xAmount / xChange; - _field1A += xAmount % xChange; - if (_field1A >= xChange) { + _changeCtr += xAmount % xChange; + if (_changeCtr >= xChange) { ++v; - _field1A -= xChange; + _changeCtr -= xChange; } xSign = _moveSign.x * v; @@ -373,7 +303,7 @@ void ObjectMover::setup(const Common::Point &destPos) { _destPosition = destPos; _moveDelta = Common::Point(diffX, diffY); _moveSign = Common::Point(xSign, ySign); - _field1A = 0; + _changeCtr = 0; if (!diffX && !diffY) // Object is already at the correct destination @@ -398,8 +328,8 @@ ObjectMover2::ObjectMover2() : ObjectMover() { _destObject = NULL; } -void ObjectMover2::synchronise(Serialiser &s) { - ObjectMover::synchronise(s); +void ObjectMover2::synchronize(Serializer &s) { + ObjectMover::synchronize(s); SYNC_POINTER(_destObject); s.syncAsSint32LE(_minArea); @@ -474,8 +404,8 @@ void NpcMover::startMove(SceneObject *sceneObj, va_list va) { /*--------------------------------------------------------------------------*/ -void PlayerMover::synchronise(Serialiser &s) { - NpcMover::synchronise(s); +void PlayerMover::synchronize(Serializer &s) { + NpcMover::synchronize(s); s.syncAsSint16LE(_finalDest.x); s.syncAsSint16LE(_finalDest.y); s.syncAsSint32LE(_routeIndex); @@ -627,7 +557,6 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo } while (routeRegions[++idx] != destRegion); tempList[idx] = 1; - idx = 0; for (int listIndex = 1; listIndex <= endIndex; ++listIndex) { int var10 = tempList[listIndex]; int var12 = tempList[listIndex + 1]; @@ -997,9 +926,11 @@ bool PlayerMover::sub_F8E5(const Common::Point &pt1, const Common::Point &pt2, c /*--------------------------------------------------------------------------*/ -void PlayerMover2::synchronise(Serialiser &s) { +void PlayerMover2::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + PlayerMover::synchronize(s); SYNC_POINTER(_destObject); - s.syncAsSint16LE(_field7E); + s.syncAsSint16LE(_maxArea); s.syncAsSint16LE(_minArea); } @@ -1016,7 +947,7 @@ void PlayerMover2::dispatch() { void PlayerMover2::startMove(SceneObject *sceneObj, va_list va) { _sceneObject = sceneObj; - _field7E = va_arg(va, int); + _maxArea = va_arg(va, int); _minArea = va_arg(va, int); _destObject = va_arg(va, SceneObject *); @@ -1036,18 +967,35 @@ PaletteModifier::PaletteModifier() { /*--------------------------------------------------------------------------*/ -PaletteRotation::PaletteRotation() : PaletteModifier() { - _disabled = false; - _delayFrames = 0; +PaletteModifierCached::PaletteModifierCached(): PaletteModifier() { + _step = 0; + _percent = 0; +} + +void PaletteModifierCached::setPalette(ScenePalette *palette, int step) { + _scenePalette = palette; + _step = step; + _percent = 100; +} + +void PaletteModifierCached::synchronize(Serializer &s) { + PaletteModifier::synchronize(s); + + s.syncAsByte(_step); + s.syncAsSint32LE(_percent); +} + +/*--------------------------------------------------------------------------*/ + +PaletteRotation::PaletteRotation() : PaletteModifierCached() { + _percent = 0; _delayCtr = 0; _frameNumber = _globals->_events.getFrameNumber(); } -void PaletteRotation::synchronise(Serialiser &s) { - PaletteModifier::synchronise(s); +void PaletteRotation::synchronize(Serializer &s) { + PaletteModifierCached::synchronize(s); - s.syncAsByte(_disabled); - s.syncAsSint32LE(_delayFrames); s.syncAsSint32LE(_delayCtr); s.syncAsUint32LE(_frameNumber); s.syncAsSint32LE(_currIndex); @@ -1055,11 +1003,7 @@ void PaletteRotation::synchronise(Serialiser &s) { s.syncAsSint32LE(_end); s.syncAsSint32LE(_rotationMode); s.syncAsSint32LE(_duration); - for (int i = 0; i < 256; ++i) { - s.syncAsByte(_palette[i].r); - s.syncAsByte(_palette[i].g); - s.syncAsByte(_palette[i].b); - } + s.syncBytes(&_palette[0], 256 * 3); } void PaletteRotation::signal() { @@ -1077,8 +1021,8 @@ void PaletteRotation::signal() { if (_delayCtr) return; - _delayCtr = _delayFrames; - if (_disabled) + _delayCtr = _percent; + if (_step) return; bool flag = true; @@ -1120,17 +1064,17 @@ void PaletteRotation::signal() { if (flag) { int count2 = _currIndex - _start; int count = _end - _currIndex; - g_system->getPaletteManager()->setPalette((const byte *)&_palette[_currIndex], _start, count); + g_system->getPaletteManager()->setPalette((const byte *)&_palette[_currIndex * 3], _start, count); if (count2) { - g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start], _start + count, count2); + g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start + count, count2); } } } void PaletteRotation::remove() { Action *action = _action; - g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start], _start, _end - _start); + g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start, _end - _start); _scenePalette->_listeners.remove(this); @@ -1141,11 +1085,11 @@ void PaletteRotation::remove() { void PaletteRotation::set(ScenePalette *palette, int start, int end, int rotationMode, int duration, Action *action) { _duration = duration; - _disabled = false; + _step = false; _action = action; _scenePalette = palette; - Common::copy(&palette->_palette[0], &palette->_palette[256], &_palette[0]); + Common::copy(&palette->_palette[0], &palette->_palette[256 * 3], &_palette[0]); _start = start; _end = end + 1; @@ -1162,12 +1106,6 @@ void PaletteRotation::set(ScenePalette *palette, int start, int end, int rotatio } } -void PaletteRotation::setPalette(ScenePalette *palette, bool disabled) { - _scenePalette = palette; - _disabled = disabled; - _delayFrames = 100; -} - bool PaletteRotation::decDuration() { if (_duration) { if (--_duration == 0) { @@ -1179,26 +1117,20 @@ bool PaletteRotation::decDuration() { } void PaletteRotation::setDelay(int amount) { - _delayFrames = _delayCtr = amount; + _percent = _delayCtr = amount; } /*--------------------------------------------------------------------------*/ -void PaletteUnknown::synchronise(Serialiser &s) { - PaletteModifier::synchronise(s); +void PaletteFader::synchronize(Serializer &s) { + PaletteModifierCached::synchronize(s); s.syncAsSint16LE(_step); s.syncAsSint16LE(_percent); - s.syncAsSint16LE(_field12); - s.syncAsSint16LE(_field14); - for (int i = 0; i < 256; ++i) { - s.syncAsByte(_palette[i].r); - s.syncAsByte(_palette[i].g); - s.syncAsByte(_palette[i].b); - } + s.syncBytes(&_palette[0], 256 * 3); } -void PaletteUnknown::signal() { +void PaletteFader::signal() { _percent -= _step; if (_percent > 0) { _scenePalette->fade((byte *)_palette, true /* 256 */, _percent); @@ -1207,35 +1139,43 @@ void PaletteUnknown::signal() { } } -void PaletteUnknown::remove() { - if (_scenePalette) { - for (int i = 0; i < 256; i++) - _scenePalette->_palette[i] = _palette[i]; - _scenePalette->refresh(); - _scenePalette->_listeners.remove(this); - delete this; - } +void PaletteFader::remove() { + // Save of a copy of the object's action, since it will be used after the object is destroyed + Action *action = _action; - if (_action) - _action->signal(); + Common::copy(&_palette[0], &_palette[256 * 3], &_scenePalette->_palette[0]); + _scenePalette->refresh(); + _scenePalette->_listeners.remove(this); + delete this; + + if (action) + action->signal(); } /*--------------------------------------------------------------------------*/ ScenePalette::ScenePalette() { // Set a default gradiant range - for (int idx = 0; idx < 256; ++idx) - _palette[idx].r = _palette[idx].g = _palette[idx].b = idx; + byte *palData = &_palette[0]; + for (int idx = 0; idx < 256; ++idx) { + *palData++ = idx; + *palData++ = idx; + *palData++ = idx; + } _field412 = 0; } +ScenePalette::~ScenePalette() { + clearListeners(); +} + ScenePalette::ScenePalette(int paletteNum) { loadPalette(paletteNum); } bool ScenePalette::loadPalette(int paletteNum) { - byte *palData = _vm->_dataManager->getResource(RES_PALETTE, paletteNum, 0, true); + byte *palData = _resourceManager->getResource(RES_PALETTE, paletteNum, 0, true); if (!palData) return false; @@ -1243,25 +1183,25 @@ bool ScenePalette::loadPalette(int paletteNum) { int palSize = READ_LE_UINT16(palData + 2); assert(palSize <= 256); - RGB8 *destP = &_palette[palStart]; - RGB8 *srcP = (RGB8 *)(palData + 6); + byte *destP = &_palette[palStart * 3]; + byte *srcP = palData + 6; - Common::copy(&srcP[0], &srcP[palSize], destP); + Common::copy(&srcP[0], &srcP[palSize * 3], destP); DEALLOCATE(palData); return true; } void ScenePalette::refresh() { - // Set indexes for standard colours to closest colour in the palette - _colours.background = indexOf(255, 255, 255); // White background - _colours.foreground = indexOf(0, 0, 0); // Black foreground - _redColour = indexOf(180, 0, 0); // Red-ish - _greenColour = indexOf(0, 180, 0); // Green-ish - _blueColour = indexOf(0, 0, 180); // Blue-ish - _aquaColour = indexOf(0, 180, 180); // Aqua - _purpleColour = indexOf(180, 0, 180); // Purple - _limeColour = indexOf(180, 180, 0); // Lime + // Set indexes for standard colors to closest color in the palette + _colors.background = indexOf(255, 255, 255); // White background + _colors.foreground = indexOf(0, 0, 0); // Black foreground + _redColor = indexOf(180, 0, 0); // Red-ish + _greenColor = indexOf(0, 180, 0); // Green-ish + _blueColor = indexOf(0, 0, 180); // Blue-ish + _aquaColor = indexOf(0, 180, 180); // Aqua + _purpleColor = indexOf(180, 0, 180); // Purple + _limeColor = indexOf(180, 180, 0); // Lime // Refresh the palette g_system->getPaletteManager()->setPalette((const byte *)&_palette[0], 0, 256); @@ -1271,27 +1211,31 @@ void ScenePalette::refresh() { * Loads a section of the palette into the game palette */ void ScenePalette::setPalette(int index, int count) { - g_system->getPaletteManager()->setPalette((const byte *)&_palette[index], index, count); + g_system->getPaletteManager()->setPalette((const byte *)&_palette[index * 3], index, count); } /** - * Returns the palette index with the closest matching colour to that specified + * Returns the palette index with the closest matching color to that specified * @param r R component * @param g G component * @param b B component * @param threshold Closeness threshold. - * @remarks A threshold may be provided to specify how close the matching colour must be + * @remarks A threshold may be provided to specify how close the matching color must be */ uint8 ScenePalette::indexOf(uint r, uint g, uint b, int threshold) { int palIndex = -1; + byte *palData = &_palette[0]; for (int i = 0; i < 256; ++i) { - int rDiff = abs(_palette[i].r - (int)r); - int gDiff = abs(_palette[i].g - (int)g); - int bDiff = abs(_palette[i].b - (int)b); + byte ir = *palData++; + byte ig = *palData++; + byte ib = *palData++; + int rDiff = abs(ir - (int)r); + int gDiff = abs(ig - (int)g); + int bDiff = abs(ib - (int)b); int idxThreshold = rDiff * rDiff + gDiff * gDiff + bDiff * bDiff; - if (idxThreshold <= threshold) { + if (idxThreshold < threshold) { threshold = idxThreshold; palIndex = i; } @@ -1310,13 +1254,16 @@ void ScenePalette::getPalette(int start, int count) { } void ScenePalette::signalListeners() { - for (SynchronisedList<PaletteModifier *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { - (*i)->signal(); + SynchronizedList<PaletteModifier *>::iterator i = _listeners.begin(); + while (i != _listeners.end()) { + PaletteModifier *obj = *i; + ++i; + obj->signal(); } } void ScenePalette::clearListeners() { - SynchronisedList<PaletteModifier *>::iterator i = _listeners.begin(); + SynchronizedList<PaletteModifier *>::iterator i = _listeners.begin(); while (i != _listeners.end()) { PaletteModifier *obj = *i; ++i; @@ -1325,14 +1272,14 @@ void ScenePalette::clearListeners() { } void ScenePalette::fade(const byte *adjustData, bool fullAdjust, int percent) { - RGB8 tempPalette[256]; + byte tempPalette[256 * 3]; // Ensure the percent adjustment is within 0 - 100% percent = CLIP(percent, 0, 100); for (int palIndex = 0; palIndex < 256; ++palIndex) { - const byte *srcP = (const byte *)&_palette[palIndex]; - byte *destP = (byte *)&tempPalette[palIndex].r; + const byte *srcP = (const byte *)&_palette[palIndex * 3]; + byte *destP = &tempPalette[palIndex * 3]; for (int rgbIndex = 0; rgbIndex < 3; ++rgbIndex, ++srcP, ++destP) { *destP = *srcP - ((*srcP - adjustData[rgbIndex]) * (100 - percent)) / 100; @@ -1358,18 +1305,21 @@ PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode, return obj; } -PaletteUnknown *ScenePalette::addUnkPal(RGB8 *arrBufferRGB, int unkNumb, bool disabled, Action *action) { - PaletteUnknown *paletteUnk = new PaletteUnknown(); - paletteUnk->_action = action; - for (int i = 0; i < 256; i++) { - if (unkNumb <= 1) - paletteUnk->_palette[i] = arrBufferRGB[i]; - else - paletteUnk->_palette[i] = arrBufferRGB[0]; +PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action) { + PaletteFader *fader = new PaletteFader(); + fader->_action = action; + for (int i = 0; i < 256 * 3; i += 3) { + fader->_palette[i] = *(arrBufferRGB + 0); + fader->_palette[i + 1] = *(arrBufferRGB + 1); + fader->_palette[i + 2] = *(arrBufferRGB + 2); + + if (palSize > 1) + arrBufferRGB += 3; } -// PaletteRotation::setPalette(this, disabled); - _globals->_scenePalette._listeners.push_back(paletteUnk); - return paletteUnk; + + fader->setPalette(this, percent); + _globals->_scenePalette._listeners.push_back(fader); + return fader; } @@ -1397,35 +1347,34 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) { _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface, bounds, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), NULL); - for (SynchronisedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i) + for (SynchronizedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i) delete *i; tempPalette._listeners.clear(); } -void ScenePalette::synchronise(Serialiser &s) { - for (int i = 0; i < 256; ++i) { - s.syncAsByte(_palette[i].r); - s.syncAsByte(_palette[i].g); - s.syncAsByte(_palette[i].b); - } - s.syncAsSint32LE(_colours.foreground); - s.syncAsSint32LE(_colours.background); +void ScenePalette::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + SavedObject::synchronize(s); + + s.syncBytes(_palette, 256 * 3); + s.syncAsSint32LE(_colors.foreground); + s.syncAsSint32LE(_colors.background); s.syncAsSint32LE(_field412); - s.syncAsByte(_redColour); - s.syncAsByte(_greenColour); - s.syncAsByte(_blueColour); - s.syncAsByte(_aquaColour); - s.syncAsByte(_purpleColour); - s.syncAsByte(_limeColour); + s.syncAsByte(_redColor); + s.syncAsByte(_greenColor); + s.syncAsByte(_blueColor); + s.syncAsByte(_aquaColor); + s.syncAsByte(_purpleColor); + s.syncAsByte(_limeColor); } /*--------------------------------------------------------------------------*/ -void SceneItem::synchronise(Serialiser &s) { - EventHandler::synchronise(s); +void SceneItem::synchronize(Serializer &s) { + EventHandler::synchronize(s); - _bounds.synchronise(s); + _bounds.synchronize(s); s.syncString(_msg); s.syncAsSint32LE(_fieldE); s.syncAsSint32LE(_field10); @@ -1473,7 +1422,7 @@ bool SceneItem::contains(const Common::Point &pt) { } void SceneItem::display(int resNum, int lineNum, ...) { - Common::String msg = !resNum ? Common::String() : _vm->_dataManager->getMessage(resNum, lineNum); + Common::String msg = !resNum ? Common::String() : _resourceManager->getMessage(resNum, lineNum); if (_globals->_sceneObjects->contains(&_globals->_sceneText)) { _globals->_sceneText.remove(); @@ -1485,7 +1434,7 @@ void SceneItem::display(int resNum, int lineNum, ...) { Rect textRect; int maxWidth = 120; bool keepOnscreen = false; - bool centreText = true; + bool centerText = true; if (resNum) { va_list va; @@ -1515,40 +1464,40 @@ void SceneItem::display(int resNum, int lineNum, ...) { _globals->_sceneText._fontNumber = va_arg(va, int); _globals->gfxManager()._font.setFontNumber(_globals->_sceneText._fontNumber); break; - case SET_BG_COLOUR: { - // Set the background colour - int bgColour = va_arg(va, int); - _globals->gfxManager()._font._colours.background = bgColour; - if (!bgColour) + case SET_BG_COLOR: { + // Set the background color + int bgColor = va_arg(va, int); + _globals->gfxManager()._font._colors.background = bgColor; + if (!bgColor) _globals->gfxManager().setFillFlag(false); break; } - case SET_FG_COLOUR: - // Set the foreground colour - _globals->_sceneText._colour1 = va_arg(va, int); - _globals->gfxManager()._font._colours.foreground = _globals->_sceneText._colour1; + case SET_FG_COLOR: + // Set the foreground color + _globals->_sceneText._color1 = va_arg(va, int); + _globals->gfxManager()._font._colors.foreground = _globals->_sceneText._color1; break; case SET_KEEP_ONSCREEN: // Suppresses immediate display keepOnscreen = va_arg(va, int) != 0; break; - case SET_EXT_BGCOLOUR: { - // Set secondary bg colour + case SET_EXT_BGCOLOR: { + // Set secondary bg color int v = va_arg(va, int); - _globals->_sceneText._colour2 = v; - _globals->gfxManager()._font._colours2.background = v; + _globals->_sceneText._color2 = v; + _globals->gfxManager()._font._colors2.background = v; break; } - case SET_EXT_FGCOLOUR: { - // Set secondary fg colour + case SET_EXT_FGCOLOR: { + // Set secondary fg color int v = va_arg(va, int); - _globals->_sceneText._colour3 = v; - _globals->gfxManager()._font._colours.foreground = v; + _globals->_sceneText._color3 = v; + _globals->gfxManager()._font._colors.foreground = v; break; } case SET_POS_MODE: // Set whether a custom x/y is used - centreText = va_arg(va, int) != 0; + centerText = va_arg(va, int) != 0; break; case SET_TEXT_MODE: // Set the text mode @@ -1565,17 +1514,17 @@ void SceneItem::display(int resNum, int lineNum, ...) { if (resNum) { // Get required bounding size _globals->gfxManager().getStringBounds(msg.c_str(), textRect, maxWidth); - textRect.centre(pos.x, pos.y); + textRect.center(pos.x, pos.y); textRect.contain(_globals->gfxManager()._bounds); - if (centreText) { - _globals->_sceneText._colour1 = _globals->_sceneText._colour2; - _globals->_sceneText._colour2 = 0; - _globals->_sceneText._colour3 = 0; + if (centerText) { + _globals->_sceneText._color1 = _globals->_sceneText._color2; + _globals->_sceneText._color2 = 0; + _globals->_sceneText._color3 = 0; } _globals->_sceneText.setup(msg); - if (centreText) { + if (centerText) { _globals->_sceneText.setPosition(Common::Point( _globals->_sceneManager._scene->_sceneBounds.left + textRect.left, _globals->_sceneManager._scene->_sceneBounds.top + textRect.top), 0); @@ -1583,7 +1532,7 @@ void SceneItem::display(int resNum, int lineNum, ...) { _globals->_sceneText.setPosition(pos, 0); } - _globals->_sceneText.setPriority2(255); + _globals->_sceneText.fixPriority(255); _globals->_sceneObjects->draw(); } @@ -1607,18 +1556,18 @@ void SceneItem::display(int resNum, int lineNum, ...) { void SceneHotspot::doAction(int action) { switch ((int)action) { case CURSOR_LOOK: - display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_USE: - display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_TALK: - display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_WALK: break; default: - display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; } } @@ -1634,13 +1583,13 @@ void NamedHotspot::doAction(int action) { if (_lookLineNum == -1) SceneHotspot::doAction(action); else - SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_USE: if (_useLineNum == -1) SceneHotspot::doAction(action); else - SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; default: SceneHotspot::doAction(action); @@ -1648,7 +1597,7 @@ void NamedHotspot::doAction(int action) { } } -void NamedHotspot::setup(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum) { +void NamedHotspot::setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { setBounds(ys, xe, ye, xs); _resnum = resnum; _lookLineNum = lookLineNum; @@ -1656,6 +1605,13 @@ void NamedHotspot::setup(const int ys, const int xe, const int ye, const int xs, _globals->_sceneItems.addItems(this, NULL); } +void NamedHotspot::synchronize(Serializer &s) { + SceneHotspot::synchronize(s); + s.syncAsSint16LE(_resnum); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_useLineNum); +} + /*--------------------------------------------------------------------------*/ void SceneObjectWrapper::setSceneObject(SceneObject *so) { @@ -1664,8 +1620,8 @@ void SceneObjectWrapper::setSceneObject(SceneObject *so) { so->_flags |= OBJFLAG_PANES; } -void SceneObjectWrapper::synchronise(Serialiser &s) { - EventHandler::synchronise(s); +void SceneObjectWrapper::synchronize(Serializer &s) { + EventHandler::synchronize(s); SYNC_POINTER(_sceneObject); } @@ -1727,7 +1683,7 @@ SceneObject::SceneObject() : SceneHotspot() { _moveDiff.y = 3; _numFrames = 10; _numFrames = 10; - _field7A = 10; + _moveRate = 10; _regionBitList = 0; _sceneRegionId = 0; _percent = 100; @@ -1857,7 +1813,7 @@ void SceneObject::setPriority(int priority) { } } -void SceneObject::setPriority2(int priority) { +void SceneObject::fixPriority(int priority) { if (priority == -1) { _flags &= ~OBJFLAG_FIXED_PRIORITY; } else { @@ -1889,8 +1845,8 @@ void SceneObject::addMover(ObjectMover *mover, ...) { if (mover) { // Set up the assigned mover _walkStartFrame = _globals->_events.getFrameNumber(); - if (_field7A != 0) - _walkStartFrame = 60 / _field7A; + if (_moveRate != 0) + _walkStartFrame = 60 / _moveRate; // Signal the mover that movement is beginning va_list va; @@ -1943,7 +1899,7 @@ int SceneObject::checkRegion(const Common::Point &pt) { } newY -= _yDiff; - SynchronisedList<SceneObject *>::iterator i; + SynchronizedList<SceneObject *>::iterator i; for (i = _globals->_sceneObjects->begin(); (regionIndex == 0) && (i != _globals->_sceneObjects->end()); ++i) { if ((*i) && ((*i)->_flags & OBJFLAG_CHECK_REGION)) { int objYDiff = (*i)->_position.y - _yDiff; @@ -2062,8 +2018,8 @@ int SceneObject::getSpliceArea(const SceneObject *obj) { return (xd * xd + yd) / 2; } -void SceneObject::synchronise(Serialiser &s) { - SceneHotspot::synchronise(s); +void SceneObject::synchronize(Serializer &s) { + SceneHotspot::synchronize(s); s.syncAsUint32LE(_updateStartFrame); s.syncAsUint32LE(_walkStartFrame); @@ -2074,8 +2030,8 @@ void SceneObject::synchronise(Serialiser &s) { s.syncAsUint32LE(_flags); s.syncAsSint16LE(_xs); s.syncAsSint16LE(_xe); - _paneRects[0].synchronise(s); - _paneRects[1].synchronise(s); + _paneRects[0].synchronize(s); + _paneRects[1].synchronize(s); s.syncAsSint32LE(_visage); SYNC_POINTER(_objectWrapper); s.syncAsSint32LE(_strip); @@ -2088,7 +2044,7 @@ void SceneObject::synchronise(Serialiser &s) { s.syncAsSint32LE(_regionIndex); SYNC_POINTER(_mover); s.syncAsSint16LE(_moveDiff.x); s.syncAsSint16LE(_moveDiff.y); - s.syncAsSint32LE(_field7A); + s.syncAsSint32LE(_moveRate); SYNC_POINTER(_endAction); s.syncAsUint32LE(_regionBitList); } @@ -2111,7 +2067,7 @@ void SceneObject::postInit(SceneObjectList *OwnerList) { _yDiff = 0; _moveDiff.x = 5; _moveDiff.y = 3; - _field7A = 10; + _moveRate = 10; _regionIndex = 0x40; _numFrames = 10; _regionBitList = 0; @@ -2138,8 +2094,8 @@ void SceneObject::dispatch() { _action->dispatch(); if (_mover && (_walkStartFrame <= currTime)) { - if (_field7A) { - int frameInc = 60 / _field7A; + if (_moveRate) { + int frameInc = 60 / _moveRate; _walkStartFrame = currTime + frameInc; } _mover->dispatch(); @@ -2235,7 +2191,6 @@ void SceneObject::removeObject() { _globals->_sceneObjects->remove(this); if (_visage) { - _vm->_memoryManager.deallocate(_visage); _visage = 0; } @@ -2247,8 +2202,9 @@ void SceneObject::removeObject() { _mover->remove(); _mover = NULL; } - if (_flags & 0x800) - destroy(); + if (_flags & OBJFLAG_CLONED) + // Cloned temporary object, so delete it + delete this; } GfxSurface SceneObject::getFrame() { @@ -2301,7 +2257,7 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i setStrip(stripFrameNum); setFrame(frameNum); setPosition(Common::Point(posX, posY), 0); - setPriority2(priority); + fixPriority(priority); } /*--------------------------------------------------------------------------*/ @@ -2368,7 +2324,7 @@ void SceneObjectList::draw() { uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1; // Initial loop to set up object list and update object position, priority, and flags - for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); + for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) { SceneObject *obj = *i; objList.push_back(obj); @@ -2381,8 +2337,8 @@ void SceneObjectList::draw() { // Handle updating object priority if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) { - obj->_priority = MIN((int)obj->_position.y - 1, - (int)_globals->_sceneManager._scene->_backgroundBounds.bottom); + obj->_priority = MIN((int)obj->_position.y, + (int)_globals->_sceneManager._scene->_backgroundBounds.bottom - 1); } if ((_globals->_paneRefreshFlag[paneNum] != 0) || !_globals->_paneRegions[paneNum].empty()) { @@ -2522,7 +2478,7 @@ void SceneObjectList::activate() { _globals->_sceneObjects_queue.push_front(this); // Flag all the objects as modified - SynchronisedList<SceneObject *>::iterator i; + SynchronizedList<SceneObject *>::iterator i; for (i = begin(); i != end(); ++i) { (*i)->_flags |= OBJFLAG_PANES; } @@ -2543,7 +2499,7 @@ void SceneObjectList::deactivate() { _globals->_sceneObjects_queue.pop_front(); _globals->_sceneObjects = *_globals->_sceneObjects_queue.begin(); - SynchronisedList<SceneObject *>::iterator i; + SynchronizedList<SceneObject *>::iterator i; for (i = objectList->begin(); i != objectList->end(); ++i) { if (!((*i)->_flags & OBJFLAG_CLONED)) { SceneObject *sceneObj = (*i)->clone(); @@ -2553,8 +2509,10 @@ void SceneObjectList::deactivate() { } } -void SceneObjectList::synchronise(Serialiser &s) { - _objList.synchronise(s); +void SceneObjectList::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + SavedObject::synchronize(s); + _objList.synchronize(s); } /*--------------------------------------------------------------------------*/ @@ -2563,8 +2521,8 @@ SceneText::SceneText() : SceneObject() { _fontNumber = 2; _width = 160; _textMode = ALIGN_LEFT; - _colour2 = 0; - _colour3 = 0; + _color2 = 0; + _color3 = 0; } SceneText::~SceneText() { @@ -2576,16 +2534,18 @@ void SceneText::setup(const Common::String &msg) { Rect textRect; gfxMan._font.setFontNumber(_fontNumber); - gfxMan._font._colours.foreground = _colour1; - gfxMan._font._colours2.background = _colour2; - gfxMan._font._colours2.foreground = _colour3; + gfxMan._font._colors.foreground = _color1; + gfxMan._font._colors2.background = _color2; + gfxMan._font._colors2.foreground = _color3; gfxMan.getStringBounds(msg.c_str(), textRect, _width); + _bounds.setWidth(textRect.width()); + _bounds.setHeight(textRect.height()); // Set up a new blank surface to hold the text _textSurface.create(textRect.width(), textRect.height()); - _textSurface._transColour = 0xff; - _textSurface.fillRect(textRect, _textSurface._transColour); + _textSurface._transColor = 0xff; + _textSurface.fillRect(textRect, _textSurface._transColor); // Write the text to the surface gfxMan._bounds = textRect; @@ -2596,14 +2556,14 @@ void SceneText::setup(const Common::String &msg) { gfxMan.deactivate(); } -void SceneText::synchronise(Serialiser &s) { - SceneObject::synchronise(s); +void SceneText::synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsSint16LE(_fontNumber); s.syncAsSint16LE(_width); - s.syncAsSint16LE(_colour1); - s.syncAsSint16LE(_colour2); - s.syncAsSint16LE(_colour3); + s.syncAsSint16LE(_color1); + s.syncAsSint16LE(_color2); + s.syncAsSint16LE(_color3); SYNC_ENUM(_textMode, TextAlign); } @@ -2638,7 +2598,7 @@ void Visage::setVisage(int resNum, int rlbNum) { _resNum = resNum; _rlbNum = rlbNum; DEALLOCATE(_data); - _data = _vm->_dataManager->getResource(RES_VISAGE, resNum, rlbNum); + _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum); assert(_data); } } @@ -2654,7 +2614,7 @@ GfxSurface Visage::getFrame(int frameNum) { if (frameNum > 0) --frameNum; - int offset = READ_UINT32(_data + 2 + frameNum * 4); + int offset = READ_LE_UINT32(_data + 2 + frameNum * 4); byte *frameData = _data + offset; return surfaceFromRes(frameData); @@ -2666,6 +2626,12 @@ int Visage::getFrameCount() const { /*--------------------------------------------------------------------------*/ +Player::Player(): SceneObject() { + _canWalk = false; + _uiEnabled = false; + _field8C = 0; +} + void Player::postInit(SceneObjectList *OwnerList) { SceneObject::postInit(); @@ -2715,8 +2681,8 @@ void Player::process(Event &event) { } } -void Player::synchronise(Serialiser &s) { - SceneObject::synchronise(s); +void Player::synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsByte(_canWalk); s.syncAsByte(_uiEnabled); @@ -2728,9 +2694,20 @@ void Player::synchronise(Serialiser &s) { Region::Region(int resNum, int rlbNum, ResourceType ctlType) { _regionId = rlbNum; - byte *regionData = _vm->_dataManager->getResource(ctlType, resNum, rlbNum); + byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum); assert(regionData); + load(regionData); + + DEALLOCATE(regionData); +} + +Region::Region(int regionId, const byte *regionData) { + _regionId = regionId; + load(regionData); +} + +void Region::load(const byte *regionData) { // Set the region bounds _bounds.top = READ_LE_UINT16(regionData + 6); _bounds.left = READ_LE_UINT16(regionData + 8); @@ -2753,8 +2730,6 @@ Region::Region(int resNum, int rlbNum, ResourceType ctlType) { _ySlices.push_back(sliceSet); } - - DEALLOCATE(regionData); } /** @@ -2940,7 +2915,7 @@ void Region::uniteRect(const Rect &rect) { void SceneRegions::load(int sceneNum) { clear(); - byte *regionData = _vm->_dataManager->getResource(RES_CONTROL, sceneNum, 9999, true); + byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, 9999, true); if (regionData) { int regionCount = READ_LE_UINT16(regionData); @@ -3202,9 +3177,20 @@ void WalkRegions::clear() { void WalkRegions::load(int sceneNum) { clear(); - _resNum = sceneNum; - byte *regionData = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 1, true); + + if (_vm->getFeatures() & GF_ALT_REGIONS) { + loadRevised(); + } else { + loadOriginal(); + } +} + +/** + * This version handles loading walk regions for Ringworld floppy version and Demo #1 + */ +void WalkRegions::loadOriginal() { + byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 1, true); if (!regionData) { // No data, so return _resNum = -1; @@ -3215,7 +3201,7 @@ void WalkRegions::load(int sceneNum) { int dataSize; // Load the field 18 list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 2); + dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 10 == 0); @@ -3229,7 +3215,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Load the idx list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 3); + dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 3); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 2 == 0); @@ -3240,7 +3226,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Load the secondary idx list - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 4); + dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 4); dataSize = _vm->_memoryManager.getSize(dataP); assert(dataSize % 2 == 0); @@ -3251,7 +3237,7 @@ void WalkRegions::load(int sceneNum) { DEALLOCATE(dataP); // Handle the loading of the actual regions themselves - dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 5); + dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 5); byte *pWalkRegion = regionData + 16; byte *srcP = dataP; @@ -3264,7 +3250,7 @@ void WalkRegions::load(int sceneNum) { wr._idxListIndex = READ_LE_UINT32(pWalkRegion + 4); wr._idxList2Index = READ_LE_UINT32(pWalkRegion + 8); - // Region in the region data + // Read in the region data int size = READ_LE_UINT16(srcP); srcP += 2; wr.loadRegion(srcP, size); @@ -3278,13 +3264,81 @@ void WalkRegions::load(int sceneNum) { } /** + * This version handles loading walk regions for Ringworld CD version and Demo #2. Given it's the newer + * version, it may also be used by future game titles + */ +void WalkRegions::loadRevised() { + byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2, true); + if (!regionData) { + // No data, so return + _resNum = -1; + return; + } + + byte *data1P = regionData + READ_LE_UINT32(regionData); + byte *data2P = regionData + READ_LE_UINT32(regionData + 4); + byte *data3P = regionData + READ_LE_UINT32(regionData + 8); + byte *data4P = regionData + READ_LE_UINT32(regionData + 12); + byte *regionOffset = regionData + 16; + int dataSize; + + // Load the field 18 list + dataSize = READ_LE_UINT32(regionData + 8) - READ_LE_UINT32(regionData + 4); + assert(dataSize % 10 == 0); + + byte *p = data2P; + for (int idx = 0; idx < (dataSize / 10); ++idx, p += 10) { + WRField18 rec; + rec.load(p); + _field18.push_back(rec); + } + + // Load the idx list + dataSize = READ_LE_UINT32(regionData + 12) - READ_LE_UINT32(regionData + 8); + assert(dataSize % 2 == 0); + + p = data3P; + for (int idx = 0; idx < (dataSize / 2); ++idx, p += 2) + _idxList.push_back(READ_LE_UINT16(p)); + + // Load the secondary idx list + dataSize = READ_LE_UINT32(regionData + 16) - READ_LE_UINT32(regionData + 12); + assert(dataSize % 2 == 0); + + p = data4P; + for (int idx = 0; idx < (dataSize / 2); ++idx, p += 2) + _idxList2.push_back(READ_LE_UINT16(p)); + + // Handle the loading of the actual regions themselves + byte *pWalkRegion = data1P + 16; + for (; (int16)READ_LE_UINT16(pWalkRegion) != -20000; pWalkRegion += 16, regionOffset += 4) { + WalkRegion wr; + byte *srcP = regionData + READ_LE_UINT32(regionOffset); + + // Set the Walk region specific fields + wr._pt.x = (int16)READ_LE_UINT16(pWalkRegion); + wr._pt.y = (int16)READ_LE_UINT16(pWalkRegion + 2); + wr._idxListIndex = READ_LE_UINT32(pWalkRegion + 4); + wr._idxList2Index = READ_LE_UINT32(pWalkRegion + 8); + + // Read in the region data + wr._regionId = 0; + wr.load(srcP); + + _regionList.push_back(wr); + } + + DEALLOCATE(regionData); +} + +/** * Returns the index of the walk region that contains the given point * @param pt Point to locate * @param indexList List of region indexes that should be ignored */ int WalkRegions::indexOf(const Common::Point &pt, const Common::List<int> *indexList) { for (uint idx = 0; idx < _regionList.size(); ++idx) { - if ((!indexList || contains(*indexList, int(idx + 1))) && _regionList[idx].contains(pt)) + if ((!indexList || !contains(*indexList, int(idx + 1))) && _regionList[idx].contains(pt)) return idx + 1; } @@ -3297,18 +3351,27 @@ void ScenePriorities::load(int resNum) { _resNum = resNum; clear(); - byte *regionData = _vm->_dataManager->getResource(RES_PRIORITY, resNum, 9999, true); + bool altMode = (_vm->getFeatures() & GF_ALT_REGIONS) != 0; + byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, altMode ? 1 : 9999, true); + if (!regionData) + return; - if (regionData) { - int regionCount = READ_LE_UINT16(regionData); - for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) { + int regionCount = READ_LE_UINT16(regionData); + for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) { + if (altMode) { + // Region data is embedded within the resource + uint16 regionId = READ_LE_UINT16(regionData + regionCtr * 6 + 2); + uint32 dataOffset = READ_LE_UINT32(regionData + regionCtr * 6 + 4); + push_back(Region(regionId, regionData + dataOffset)); + } else { + // The data contains the index of another resource containing the region data int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2); push_back(Region(resNum, rlbNum, RES_PRIORITY)); } - - DEALLOCATE(regionData); } + + DEALLOCATE(regionData); } Region *ScenePriorities::find(int priority) { @@ -3319,7 +3382,7 @@ Region *ScenePriorities::find(int priority) { if (priority > 255) priority = 255; - // Loop through the regions to find the closest for the givne priority level + // Loop through the regions to find the closest for the given priority level int minRegionId = 9998; Region *region = NULL; for (ScenePriorities::iterator i = begin(); i != end(); ++i) { @@ -3368,7 +3431,7 @@ GameHandler::GameHandler() : EventHandler() { GameHandler::~GameHandler() { if (_globals) - _globals->_game.removeHandler(this); + _globals->_game->removeHandler(this); } void GameHandler::execute() { @@ -3378,9 +3441,12 @@ void GameHandler::execute() { } } -void GameHandler::synchronise(Serialiser &s) { - _lockCtr.synchronise(s); - _waitCtr.synchronise(s); +void GameHandler::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + EventHandler::synchronize(s); + + _lockCtr.synchronize(s); + _waitCtr.synchronize(s); s.syncAsSint16LE(_nextWaitCtr); s.syncAsSint16LE(_field14); } @@ -3394,7 +3460,7 @@ SceneHandler::SceneHandler() { void SceneHandler::registerHandler() { postInit(); - _globals->_game.addHandler(this); + _globals->_game->addHandler(this); } void SceneHandler::postInit(SceneObjectList *OwnerList) { @@ -3406,21 +3472,7 @@ void SceneHandler::postInit(SceneObjectList *OwnerList) { // TODO: Bunch of other scene related setup goes here _globals->_soundManager.postInit(); - // Set some default flags and cursor - _globals->setFlag(12); - _globals->setFlag(34); - _globals->_events.setCursor(CURSOR_WALK); - - // Set the screen to scroll in response to the player moving off-screen - _globals->_scrollFollower = &_globals->_player; - - // Set the object's that will be in the player's inventory by default - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._scanner._sceneNumber = 1; - _globals->_inventory._ring._sceneNumber = 1; - - // Switch to the title screen - _globals->_sceneManager.setNewScene(1000); + _globals->_game->start(); } void SceneHandler::process(Event &event) { @@ -3429,8 +3481,7 @@ void SceneHandler::process(Event &event) { switch (event.kbd.keycode) { case Common::KEYCODE_F1: // F1 - Help - _globals->_events.setCursor(CURSOR_ARROW); - MessageDialog::show(HELP_MSG, OK_BTN_STRING); + MessageDialog::show((_vm->getFeatures() & GF_DEMO) ? DEMO_HELP_MSG : HELP_MSG, OK_BTN_STRING); break; case Common::KEYCODE_F2: { @@ -3444,19 +3495,19 @@ void SceneHandler::process(Event &event) { case Common::KEYCODE_F3: // F3 - Quit - _globals->_game.quitGame(); + _globals->_game->quitGame(); event.handled = false; break; case Common::KEYCODE_F4: // F4 - Restart - _globals->_game.restartGame(); + _globals->_game->restartGame(); _globals->_events.setCursorFromFlag(); break; case Common::KEYCODE_F7: // F7 - Restore - _globals->_game.restoreGame(); + _globals->_game->restoreGame(); _globals->_events.setCursorFromFlag(); break; @@ -3493,7 +3544,7 @@ void SceneHandler::process(Event &event) { // Separate check for F5 - Save key if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_F5)) { // F5 - Save - _globals->_game.saveGame(); + _globals->_game->saveGame(); event.handled = true; _globals->_events.setCursorFromFlag(); } @@ -3510,7 +3561,7 @@ void SceneHandler::process(Event &event) { if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) && !_globals->_sceneItems.empty()) { // Scan the item list to find one the mouse is within - SynchronisedList<SceneItem *>::iterator i = _globals->_sceneItems.begin(); + SynchronizedList<SceneItem *>::iterator i = _globals->_sceneItems.begin(); while ((i != _globals->_sceneItems.end()) && !(*i)->contains(event.mousePos)) ++i; @@ -3540,7 +3591,10 @@ void SceneHandler::dispatch() { if (_saveGameSlot != -1) { int saveSlot = _saveGameSlot; _saveGameSlot = -1; - if (_saver->save(saveSlot, _saveName) != Common::kNoError) + Common::Error err = _saver->save(saveSlot, _saveName); + // FIXME: Make use of the description string in err to enhance + // the error reported to the user. + if (err.getCode() != Common::kNoError) GUIErrorMessage(SAVE_ERROR_MSG); } if (_loadGameSlot != -1) { @@ -3585,7 +3639,7 @@ void SceneHandler::dispatchObject(EventHandler *obj) { obj->dispatch(); } -void SceneHandler::saveListener(Serialiser &ser) { +void SceneHandler::saveListener(Serializer &ser) { warning("TODO: SceneHandler::saveListener"); } @@ -3597,7 +3651,7 @@ void Game::execute() { do { // Process all currently atcive game handlers activeFlag = false; - for (SynchronisedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { + for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) { GameHandler *gh = *i; if (gh->_lockCtr.getCtr() == 0) { gh->execute(); @@ -3607,129 +3661,4 @@ void Game::execute() { } while (activeFlag && !_vm->getEventManager()->shouldQuit()); } -void Game::restartGame() { - if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) - _globals->_game.restart(); -} - -void Game::saveGame() { - if (_globals->getFlag(50)) - MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the save dialog - handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName); - } -} - -void Game::restoreGame() { - if (_globals->getFlag(50)) - MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the load dialog - handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); - } -} - -void Game::quitGame() { - if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) - _vm->quitGame(); -} - -void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { - const EnginePlugin *plugin = 0; - EngineMan.findGame(_vm->getGameId(), &plugin); - GUI::SaveLoadChooser *dialog; - if (saveFlag) - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - else - dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - - dialog->setSaveMode(saveFlag); - - saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); - saveName = dialog->getResultString(); - - delete dialog; -} - -void Game::restart() { - _globals->_scenePalette.clearListeners(); - _globals->_soundHandler.proc3(); - - // Reset the flags - _globals->reset(); - _globals->setFlag(34); - - // Clear save/load slots - _globals->_sceneHandler._saveGameSlot = -1; - _globals->_sceneHandler._loadGameSlot = -1; - - _globals->_stripNum = 0; - _globals->_events.setCursor(CURSOR_WALK); - - // Reset item properties - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._scanner._sceneNumber = 1; - _globals->_inventory._stasisBox._sceneNumber = 5200; - _globals->_inventory._infoDisk._sceneNumber = 40; - _globals->_inventory._stasisNegator._sceneNumber = 0; - _globals->_inventory._keyDevice._sceneNumber = 0; - _globals->_inventory._medkit._sceneNumber = 2280; - _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_inventory._rope._sceneNumber = 4150; - _globals->_inventory._key._sceneNumber = 7700; - _globals->_inventory._translator._sceneNumber = 2150; - _globals->_inventory._paper._sceneNumber = 7700; - _globals->_inventory._waldos._sceneNumber = 0; - _globals->_inventory._ring._sceneNumber = 1; - _globals->_inventory._stasisBox2._sceneNumber = 8100; - _globals->_inventory._cloak._sceneNumber = 9850; - _globals->_inventory._tunic._sceneNumber = 9450; - _globals->_inventory._candle._sceneNumber = 9500; - _globals->_inventory._straw._sceneNumber = 9400; - _globals->_inventory._scimitar._sceneNumber = 9850; - _globals->_inventory._sword._sceneNumber = 9850; - _globals->_inventory._helmet._sceneNumber = 9500; - _globals->_inventory._items._sceneNumber = 4300; - _globals->_inventory._concentrator._sceneNumber = 4300; - _globals->_inventory._nullifier._sceneNumber = 4300; - _globals->_inventory._peg._sceneNumber = 4045; - _globals->_inventory._vial._sceneNumber = 5100; - _globals->_inventory._jacket._sceneNumber = 9850; - _globals->_inventory._tunic2._sceneNumber = 9850; - _globals->_inventory._bone._sceneNumber = 5300; - _globals->_inventory._jar._sceneNumber = 7700; - _globals->_inventory._emptyJar._sceneNumber = 7700; - - // Change to the first game scene - _globals->_sceneManager.changeScene(30); -} - -void Game::endGame(int resNum, int lineNum) { - _globals->_events.setCursor(CURSOR_WALK); - Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum); - bool savesExist = _saver->savegamesExist(); - - if (!savesExist) { - // No savegames exist, so prompt the user to restart or quit - if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0) - _vm->quitGame(); - else - restart(); - } else { - // Savegames exist, so prompt for Restore/Restart - bool breakFlag; - do { - if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) { - breakFlag = true; - } else { - handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); - breakFlag = _globals->_sceneHandler._loadGameSlot > 0; - } - } while (!breakFlag); - } - - _globals->_events.setCursorFromFlag(); -} - } // End of namespace tSage diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 77923606d1..001b478fc9 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -47,7 +47,7 @@ class SceneObject; class SceneObjectList; class ObjectMover; class Action; -class Serialiser; +class Serializer; class InvObject : public SavedObject { public: @@ -66,54 +66,20 @@ public: void setCursor(); virtual Common::String getClassName() { return "InvObject"; } - virtual void synchronise(Serialiser &s) { + virtual void synchronize(Serializer &s) { s.syncAsUint16LE(_sceneNumber); } }; class InvObjectList : public SavedObject { public: - InvObject _stunner; - InvObject _scanner; - InvObject _stasisBox; - InvObject _infoDisk; - InvObject _stasisNegator; - InvObject _keyDevice; - InvObject _medkit; - InvObject _ladder; - InvObject _rope; - InvObject _key; - InvObject _translator; - InvObject _ale; - InvObject _paper; - InvObject _waldos; - InvObject _stasisBox2; - InvObject _ring; - InvObject _cloak; - InvObject _tunic; - InvObject _candle; - InvObject _straw; - InvObject _scimitar; - InvObject _sword; - InvObject _helmet; - InvObject _items; - InvObject _concentrator; - InvObject _nullifier; - InvObject _peg; - InvObject _vial; - InvObject _jacket; - InvObject _tunic2; - InvObject _bone; - InvObject _jar; - InvObject _emptyJar; - - SynchronisedList<InvObject *> _itemList; + SynchronizedList<InvObject *> _itemList; InvObject *_selectedItem; -public: + InvObjectList(); virtual Common::String getClassName() { return "InvObjectList"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); }; /*--------------------------------------------------------------------------*/ @@ -139,7 +105,7 @@ public: int incCtr() { return ++_ctr; } int getCtr() const { return _ctr; } - virtual void synchronise(Serialiser &s) { s.syncAsSint16LE(_ctr); } + virtual void synchronize(Serializer &s) { s.syncAsSint16LE(_ctr); } }; class EventHandler : public SavedObject { @@ -149,7 +115,7 @@ public: EventHandler() : SavedObject() { _action = NULL; } virtual ~EventHandler() { destroy(); } - virtual void synchronise(Serialiser &s) { SYNC_POINTER(_action); } + virtual void synchronize(Serializer &s) { SYNC_POINTER(_action); } virtual Common::String getClassName() { return "EventHandler"; } virtual void postInit(SceneObjectList *OwnerList = NULL) {} virtual void remove() {} @@ -157,7 +123,7 @@ public: virtual void process(Event &event) {} virtual void dispatch(); virtual void setAction(Action *action) { setAction(action, NULL); } - virtual void setAction(Action *action, EventHandler *fmt, ...); + virtual void setAction(Action *action, EventHandler *endHandler, ...); virtual void destroy() {}; }; @@ -167,22 +133,22 @@ public: int _actionIndex; int _delayFrames; uint32 _startFrame; - int _field16; - EventHandler *_fmt; + bool _attached; + EventHandler *_endHandler; Action(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "Action"; } virtual void remove(); virtual void process(Event &event); virtual void dispatch(); - virtual void attached(EventHandler *newOwner, EventHandler *fmt, va_list va); + virtual void attached(EventHandler *newOwner, EventHandler *endHandler, va_list va); - void attach(EventHandler *newOwner, EventHandler *fmt, ...) { + void attach(EventHandler *newOwner, EventHandler *endHandler, ...) { va_list va; - va_start(va, fmt); - attached(newOwner, fmt, va); + va_start(va, endHandler); + attached(newOwner, endHandler, va); va_end(va); } int getActionIndex() const { return _actionIndex; } @@ -202,14 +168,14 @@ public: Common::Point _moveSign; int _minorDiff; int _majorDiff; - int _field1A; + int _changeCtr; Action *_action; SceneObject *_sceneObject; public: ObjectMover() { _action = NULL; _sceneObject = NULL; } virtual ~ObjectMover(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "ObjectMover"; } virtual void remove(); virtual void dispatch(); @@ -228,7 +194,7 @@ public: ObjectMover2(); virtual ~ObjectMover2() {} - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "ObjectMover2"; } virtual void dispatch(); virtual void startMove(SceneObject *sceneObj, va_list va); @@ -278,7 +244,7 @@ public: Common::Point _routeList[MAX_ROUTE_SIZE]; int _routeIndex; - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "PlayerMover"; } virtual void startMove(SceneObject *sceneObj, va_list va); virtual void endMove(); @@ -287,11 +253,11 @@ public: class PlayerMover2 : public PlayerMover { public: SceneObject *_destObject; - int _field7E; + int _maxArea; int _minArea; PlayerMover2() : PlayerMover() { _destObject = NULL; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "PlayerMover2"; } virtual void dispatch(); virtual void startMove(SceneObject *sceneObj, va_list va); @@ -309,7 +275,7 @@ public: public: PaletteModifier(); - virtual void synchronise(Serialiser &s) { + virtual void synchronize(Serializer &s) { SYNC_POINTER(_scenePalette); SYNC_POINTER(_action); } @@ -317,10 +283,21 @@ public: virtual void remove() = 0; }; -class PaletteRotation : public PaletteModifier { +class PaletteModifierCached: public PaletteModifier { +public: + byte _palette[256 * 3]; + int _step; + int _percent; + + PaletteModifierCached(); + + void setPalette(ScenePalette *palette, int step); + virtual Common::String getClassName() { return "PaletteModifierCached"; } + virtual void synchronize(Serializer &s); +}; + +class PaletteRotation: public PaletteModifierCached { public: - bool _disabled; - int _delayFrames; int _delayCtr; uint32 _frameNumber; int _currIndex; @@ -328,53 +305,51 @@ public: int _end; int _rotationMode; int _duration; - RGB8 _palette[256]; public: PaletteRotation(); virtual Common::String getClassName() { return "PaletteRotation"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); virtual void remove(); - void setDisabled(bool v) { _disabled = v; } + void setStep(int step) { _step = step; } void set(ScenePalette *palette, int start, int end, int rotationMode, int duration, Action *action); - void setPalette(ScenePalette *palette, bool disabled); bool decDuration(); void setDelay(int amount); }; -/*--------------------------------------------------------------------------*/ - -class PaletteUnknown : public PaletteModifier { +class PaletteFader: public PaletteModifierCached { public: - int _step, _percent, _field12, _field14; - RGB8 _palette[256]; + byte _palette[256 * 3]; public: - virtual Common::String getClassName() { return "PaletteUnknown"; } - virtual void synchronise(Serialiser &s); + virtual Common::String getClassName() { return "PaletteFader"; } + virtual void synchronize(Serializer &s); virtual void signal(); virtual void remove(); }; +/*--------------------------------------------------------------------------*/ + enum FadeMode {FADEMODE_NONE = 0, FADEMODE_GRADUAL = 1, FADEMODE_IMMEDIATE = 2}; class ScenePalette : public SavedObject { public: - RGB8 _palette[256]; - GfxColours _colours; - SynchronisedList<PaletteModifier *> _listeners; + byte _palette[256 * 3]; + GfxColors _colors; + SynchronizedList<PaletteModifier *> _listeners; int _field412; - uint8 _redColour; - uint8 _greenColour; - uint8 _blueColour; - uint8 _aquaColour; - uint8 _purpleColour; - uint8 _limeColour; + uint8 _redColor; + uint8 _greenColor; + uint8 _blueColor; + uint8 _aquaColor; + uint8 _purpleColor; + uint8 _limeColor; public: ScenePalette(); ScenePalette(int paletteNum); + ~ScenePalette(); bool loadPalette(int paletteNum); void refresh(); @@ -385,11 +360,11 @@ public: void clearListeners(); void fade(const byte *adjustData, bool fullAdjust, int percent); PaletteRotation *addRotation(int start, int end, int rotationMode, int duration = 0, Action *action = NULL); - PaletteUnknown *addUnkPal(RGB8 *arrBufferRGB, int unkNumb, bool disabled, Action *action); + PaletteFader *addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action); static void changeBackground(const Rect &bounds, FadeMode fadeMode); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "ScenePalette"; } }; @@ -398,11 +373,11 @@ const int SET_WIDTH = 0; const int SET_X = 1; const int SET_Y = 2; const int SET_FONT = 3; -const int SET_BG_COLOUR = 4; -const int SET_FG_COLOUR = 5; +const int SET_BG_COLOR = 4; +const int SET_FG_COLOR = 5; const int SET_KEEP_ONSCREEN = 6; -const int SET_EXT_BGCOLOUR = 7; -const int SET_EXT_FGCOLOUR = 8; +const int SET_EXT_BGCOLOR = 7; +const int SET_EXT_FGCOLOR = 8; const int SET_POS_MODE = 9; const int SET_TEXT_MODE = 10; const int LIST_END = -999; @@ -418,7 +393,7 @@ public: public: SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneItem"; } virtual void remove(); virtual void destroy() {} @@ -430,7 +405,7 @@ public: void setBounds(const int ys, const int xe, const int ye, const int xs) { _bounds = Rect(MIN(xs, xe), MIN(ys, ye), MAX(xs, xe), MAX(ys, ye)); } static void display(int resNum, int lineNum, ...); static void display2(int resNum, int lineNum) { - display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } }; @@ -439,8 +414,8 @@ public: int _state; virtual Common::String getClassName() { return "SceneItemExt"; } - virtual void synchronise(Serialiser &s) { - SceneItem::synchronise(s); + virtual void synchronize(Serializer &s) { + SceneItem::synchronize(s); s.syncAsSint16LE(_state); } }; @@ -458,9 +433,10 @@ public: int _resnum, _lookLineNum, _useLineNum; NamedHotspot() : SceneHotspot() {} - void setup(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum); + void setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); virtual void doAction(int action); virtual Common::String getClassName() { return "NamedHotspot"; } + virtual void synchronize(Serializer &s); }; enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3, @@ -496,7 +472,7 @@ public: void setSceneObject(SceneObject *so); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneObjectWrapper"; } virtual void remove(); virtual void dispatch(); @@ -538,7 +514,7 @@ public: int _regionIndex; EventHandler *_mover; Common::Point _moveDiff; - int _field7A; + int _moveRate; Action *_endAction; uint32 _regionBitList; public: @@ -555,7 +531,7 @@ public: void setFrame(int frameNum); void setFrame2(int frameNum); void setPriority(int priority); - void setPriority2(int priority); + void fixPriority(int priority); void setVisage(int visage); void setObjectWrapper(SceneObjectWrapper *objWrapper); void addMover(ObjectMover *mover, ...); @@ -570,7 +546,7 @@ public: int getSpliceArea(const SceneObject *obj); int getFrameCount(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneObject"; } virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); @@ -590,8 +566,8 @@ class SceneObjectExt : public SceneObject { public: int _state; - virtual void synchronise(Serialiser &s) { - SceneObject::synchronise(s); + virtual void synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsSint16LE(_state); } virtual Common::String getClassName() { return "SceneObjectExt"; } @@ -602,9 +578,9 @@ public: int _fontNumber; int _width; TextAlign _textMode; - int _colour1; - int _colour2; - int _colour3; + int _color1; + int _color2; + int _color3; GfxSurface _textSurface; public: SceneText(); @@ -612,7 +588,7 @@ public: void setup(const Common::String &msg); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneText"; } virtual GfxSurface getFrame() { return _textSurface; } }; @@ -623,10 +599,10 @@ public: bool _uiEnabled; int _field8C; public: - Player() : SceneObject() {} + Player(); virtual Common::String getClassName() { return "Player"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); @@ -669,7 +645,9 @@ public: public: Region() { _regionSize = 0; _regionId = 0; } Region(int resNum, int rlbNum, ResourceType ctlType = RES_CONTROL); + Region(int regionId, const byte *regionData); + void load(const byte *regionData); bool contains(const Common::Point &pt); bool empty() const; void clear(); @@ -695,14 +673,14 @@ class SceneObjectList : public SavedObject { private: void checkIntersection(Common::Array<SceneObject *> &ObjList, uint ObjIndex, int PaneNum); - SynchronisedList<SceneObject *> _objList; + SynchronizedList<SceneObject *> _objList; bool _listAltered; public: SceneObjectList() { _listAltered = false; } void sortList(Common::Array<SceneObject *> &ObjList); virtual Common::String getClassName() { return "SceneObjectList"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); void draw(); void activate(); @@ -712,14 +690,15 @@ public: void recurse(EventHandlerFn Fn) { // Loop through each object _listAltered = false; - for (SynchronisedList<SceneObject *>::iterator i = _objList.begin(); i != _objList.end() && !_listAltered; ) { + for (SynchronizedList<SceneObject *>::iterator i = _objList.begin(); i != _objList.end() && !_listAltered; ) { SceneObject *o = *i; ++i; Fn(o); } } - SynchronisedList<SceneObject *>::iterator begin() { return _objList.begin(); } - SynchronisedList<SceneObject *>::iterator end() { return _objList.end(); } + SynchronizedList<SceneObject *>::iterator begin() { return _objList.begin(); } + SynchronizedList<SceneObject *>::iterator end() { return _objList.end(); } + int size() const { return _objList.size(); } bool contains(SceneObject *sceneObj) { return tSage::contains(_objList, sceneObj); } void push_back(SceneObject *sceneObj) { _objList.push_back(sceneObj); } void push_front(SceneObject *sceneObj) { _objList.push_front(sceneObj); } @@ -811,7 +790,7 @@ public: /*--------------------------------------------------------------------------*/ -class SceneItemList : public SynchronisedList<SceneItem *> { +class SceneItemList : public SynchronizedList<SceneItem *> { public: void addItems(SceneItem *first, ...); }; @@ -861,6 +840,9 @@ public: }; class WalkRegions { +private: + void loadOriginal(); + void loadRevised(); public: int _resNum; RouteEnds _routeEnds; @@ -905,7 +887,7 @@ public: virtual ~GameHandler(); void execute(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "GameHandler"; } virtual void postInit(SceneObjectList *OwnerList = NULL) {} virtual void dispatch() {} @@ -927,28 +909,31 @@ public: virtual void dispatch(); static void dispatchObject(EventHandler *obj); - static void saveListener(Serialiser &ser); + static void saveListener(Serializer &ser); }; /*--------------------------------------------------------------------------*/ class Game { -private: - SynchronisedList<GameHandler *> _handlers; +protected: + SynchronizedList<GameHandler *> _handlers; static bool notLockedFn(GameHandler *g); - void restart(); - void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} public: + virtual ~Game() {} + void addHandler(GameHandler *entry) { _handlers.push_back(entry); } void removeHandler(GameHandler *entry) { _handlers.remove(entry); } void execute(); - void restartGame(); - void saveGame(); - void restoreGame(); - void quitGame(); - void endGame(int resNum, int lineNum); + virtual void start() = 0; + virtual void restart() {} + virtual void restartGame() {} + virtual void saveGame() {} + virtual void restoreGame() {} + virtual void quitGame() {} + virtual void endGame(int resNum, int lineNum) {} }; } // End of namespace tSage diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index d04fd71461..7944bad776 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -24,11 +24,9 @@ */ #include "tsage/debugger.h" -#include "common/config-manager.h" -#include "common/endian.h" #include "tsage/globals.h" #include "tsage/graphics.h" - +#include "tsage/ringworld_logic.h" namespace tSage { @@ -37,7 +35,12 @@ Debugger::Debugger() : GUI::Debugger() { DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions)); DCmd_Register("priority_regions", WRAP_METHOD(Debugger, Cmd_PriorityRegions)); - DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); + DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag)); + DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag)); + DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag)); + DCmd_Register("listobjects", WRAP_METHOD(Debugger, Cmd_ListObjects)); + DCmd_Register("moveobject", WRAP_METHOD(Debugger, Cmd_MoveObject)); + DCmd_Register("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots)); } static int strToInt(const char *s) { @@ -81,14 +84,16 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { return true; } - // Colour index to use for the first walk region - int colour = 16; + // Color index to use for the first walk region + int color = 16; // Lock the background surface for access Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface(); - // Loop through drawing each walk region in a different colour to the background surface - for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++colour) { + // Loop through drawing each walk region in a different color to the background surface + Common::String regionsDesc; + + for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++color) { WalkRegion &wr = _globals->_walkRegions._regionList[regionIndex]; for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) { @@ -96,8 +101,11 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { for (uint idx = 0; idx < sliceSet.items.size(); ++idx) destSurface.hLine(sliceSet.items[idx].xs - _globals->_sceneOffset.x, yp, - sliceSet.items[idx].xe - _globals->_sceneOffset.x, colour); + sliceSet.items[idx].xe - _globals->_sceneOffset.x, color); } + + regionsDesc += Common::String::format("Region #%d d bounds=%d,%d,%d,%d\n", + regionIndex, wr._bounds.left, wr._bounds.top, wr._bounds.right, wr._bounds.bottom); } // Release the surface @@ -106,6 +114,9 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) { // Mark the scene as requiring a full redraw _globals->_paneRefreshFlag[0] = 2; + DebugPrintf("Total regions = %d\n", _globals->_walkRegions._regionList.size()); + DebugPrintf("%s\n", regionsDesc.c_str()); + return false; } @@ -119,8 +130,8 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { if (argc == 2) regionNum = strToInt(argv[1]); - // Colour index to use for the first priority region - int colour = 16; + // Color index to use for the first priority region + int color = 16; int count = 0; // Lock the background surface for access @@ -129,7 +140,7 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { Common::List<Region>::iterator i = _globals->_sceneManager._scene->_priorities.begin(); Common::String regionsDesc; - for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++colour, ++count) { + for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) { Region &r = *i; if ((regionNum == 0) || (regionNum == (count + 1))) { @@ -139,7 +150,7 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { for (int x = 0; x < destSurface.w; ++x) { if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x, _globals->_sceneManager._scene->_sceneBounds.top + y))) - *destP = colour; + *destP = color; ++destP; } } @@ -161,12 +172,269 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { return true; } -/** - * Give a specified item to the player +/* + * This command sets a flag */ -bool Debugger::Cmd_Item(int argc, const char **argv) { - _globals->_inventory._infoDisk._sceneNumber = 1; +bool Debugger::Cmd_SetFlag(int argc, const char **argv) { + // Check for a flag to set + if (argc != 2) { + DebugPrintf("Usage: %s <flag number>\n", argv[0]); + return true; + } + + int flagNum = strToInt(argv[1]); + _globals->setFlag(flagNum); return true; } +/* + * This command gets the value of a flag + */ +bool Debugger::Cmd_GetFlag(int argc, const char **argv) { + // Check for an flag to display + if (argc != 2) { + DebugPrintf("Usage: %s <flag number>\n", argv[0]); + return true; + } + + int flagNum = strToInt(argv[1]); + DebugPrintf("Value: %d\n", _globals->getFlag(flagNum)); + return true; +} + +/* + * This command clears a flag + */ +bool Debugger::Cmd_ClearFlag(int argc, const char **argv) { + // Check for a flag to clear + if (argc != 2) { + DebugPrintf("Usage: %s <flag number>\n", argv[0]); + return true; + } + + int flagNum = strToInt(argv[1]); + _globals->clearFlag(flagNum); + return true; +} + +/* + * This command lists the objects available, and their ID + */ +bool Debugger::Cmd_ListObjects(int argc, const char **argv) { + if (argc != 1) { + DebugPrintf("Usage: %s\n", argv[0]); + return true; + } + + DebugPrintf("Available objects for this game are:\n"); + DebugPrintf("0 - Stunner\n"); + DebugPrintf("1 - Scanner\n"); + DebugPrintf("2 - Stasis Box\n"); + DebugPrintf("3 - Info Disk\n"); + DebugPrintf("4 - Stasis Negator\n"); + DebugPrintf("5 - Key Device\n"); + DebugPrintf("6 - Medkit\n"); + DebugPrintf("7 - Ladder\n"); + DebugPrintf("8 - Rope\n"); + DebugPrintf("9 - Key\n"); + DebugPrintf("10 - Translator\n"); + DebugPrintf("11 - Ale\n"); + DebugPrintf("12 - Paper\n"); + DebugPrintf("13 - Waldos\n"); + DebugPrintf("14 - Stasis Box 2\n"); + DebugPrintf("15 - Ring\n"); + DebugPrintf("16 - Cloak\n"); + DebugPrintf("17 - Tunic\n"); + DebugPrintf("18 - Candle\n"); + DebugPrintf("19 - Straw\n"); + DebugPrintf("20 - Scimitar\n"); + DebugPrintf("21 - Sword\n"); + DebugPrintf("22 - Helmet\n"); + DebugPrintf("23 - Items\n"); + DebugPrintf("24 - Concentrator\n"); + DebugPrintf("25 - Nullifier\n"); + DebugPrintf("26 - Peg\n"); + DebugPrintf("27 - Vial\n"); + DebugPrintf("28 - Jacket\n"); + DebugPrintf("29 - Tunic 2\n"); + DebugPrintf("30 - Bone\n"); + DebugPrintf("31 - Empty Jar\n"); + DebugPrintf("32 - Jar\n"); + return true; +} + +/* + * This command gets an item, or move it to a room + */ +bool Debugger::Cmd_MoveObject(int argc, const char **argv) { + // Check for a flag to clear + if ((argc < 2) || (argc > 3)){ + DebugPrintf("Usage: %s <object number> [<scene number>]\n", argv[0]); + DebugPrintf("If no scene is specified, the object will be added to inventory\n"); + return true; + } + + int objNum = strToInt(argv[1]); + int sceneNum = 1; + if (argc == 3) + sceneNum = strToInt(argv[2]); + + switch (objNum) { + case OBJECT_STUNNER: + RING_INVENTORY._stunner._sceneNumber = sceneNum; + break; + case OBJECT_SCANNER: + RING_INVENTORY._scanner._sceneNumber = sceneNum; + break; + case OBJECT_STASIS_BOX: + RING_INVENTORY._stasisBox._sceneNumber = sceneNum; + break; + case OBJECT_INFODISK: + RING_INVENTORY._infoDisk._sceneNumber = sceneNum; + break; + case OBJECT_STASIS_NEGATOR: + RING_INVENTORY._stasisNegator._sceneNumber = sceneNum; + break; + case OBJECT_KEY_DEVICE: + RING_INVENTORY._keyDevice._sceneNumber = sceneNum; + break; + case OBJECT_MEDKIT: + RING_INVENTORY._medkit._sceneNumber = sceneNum; + break; + case OBJECT_LADDER: + RING_INVENTORY._ladder._sceneNumber = sceneNum; + break; + case OBJECT_ROPE: + RING_INVENTORY._rope._sceneNumber = sceneNum; + break; + case OBJECT_KEY: + RING_INVENTORY._key._sceneNumber = sceneNum; + break; + case OBJECT_TRANSLATOR: + RING_INVENTORY._translator._sceneNumber = sceneNum; + break; + case OBJECT_ALE: + RING_INVENTORY._ale._sceneNumber = sceneNum; + break; + case OBJECT_PAPER: + RING_INVENTORY._paper._sceneNumber = sceneNum; + break; + case OBJECT_WALDOS: + RING_INVENTORY._waldos._sceneNumber = sceneNum; + break; + case OBJECT_STASIS_BOX2: + RING_INVENTORY._stasisBox2._sceneNumber = sceneNum; + break; + case OBJECT_RING: + RING_INVENTORY._ring._sceneNumber = sceneNum; + break; + case OBJECT_CLOAK: + RING_INVENTORY._cloak._sceneNumber = sceneNum; + break; + case OBJECT_TUNIC: + RING_INVENTORY._tunic._sceneNumber = sceneNum; + break; + case OBJECT_CANDLE: + RING_INVENTORY._candle._sceneNumber = sceneNum; + break; + case OBJECT_STRAW: + RING_INVENTORY._straw._sceneNumber = sceneNum; + break; + case OBJECT_SCIMITAR: + RING_INVENTORY._scimitar._sceneNumber = sceneNum; + break; + case OBJECT_SWORD: + RING_INVENTORY._sword._sceneNumber = sceneNum; + break; + case OBJECT_HELMET: + RING_INVENTORY._helmet._sceneNumber = sceneNum; + break; + case OBJECT_ITEMS: + RING_INVENTORY._items._sceneNumber = sceneNum; + break; + case OBJECT_CONCENTRATOR: + RING_INVENTORY._concentrator._sceneNumber = sceneNum; + break; + case OBJECT_NULLIFIER: + RING_INVENTORY._nullifier._sceneNumber = sceneNum; + break; + case OBJECT_PEG: + RING_INVENTORY._peg._sceneNumber = sceneNum; + break; + case OBJECT_VIAL: + RING_INVENTORY._vial._sceneNumber = sceneNum; + break; + case OBJECT_JACKET: + RING_INVENTORY._jacket._sceneNumber = sceneNum; + break; + case OBJECT_TUNIC2: + RING_INVENTORY._tunic2._sceneNumber = sceneNum; + break; + case OBJECT_BONE: + RING_INVENTORY._bone._sceneNumber = sceneNum; + break; + case OBJECT_EMPTY_JAR: + RING_INVENTORY._emptyJar._sceneNumber = sceneNum; + break; + case OBJECT_JAR: + RING_INVENTORY._jar._sceneNumber = sceneNum; + break; + default: + DebugPrintf("Invlid object Id %s\n", argv[1]); + } + + return true; +} + +/** + * Show any active hotspot areas in the scene + */ +bool Debugger::Cmd_Hotspots(int argc, const char **argv) { + int colIndex = 16; + const Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds; + + // Lock the background surface for access + Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface(); + + // Iterate through the scene items + SynchronizedList<SceneItem *>::iterator i; + for (i = _globals->_sceneItems.reverse_begin(); i != _globals->_sceneItems.end(); --i, ++colIndex) { + SceneItem *o = *i; + + // Draw the contents of the hotspot area + if (o->_sceneRegionId == 0) { + // Scene item doesn't use a region, so fill in the entire area + destSurface.fillRect(Rect(o->_bounds.left - sceneBounds.left, o->_bounds.top - sceneBounds.top, + o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex); + } else { + // Scene uses a region, so get it and use it to fill out only the correct parts + SceneRegions::iterator ri = _globals->_sceneRegions.begin(); + while ((ri != _globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId)) + ++ri; + + if (ri != _globals->_sceneRegions.end()) { + // Fill out the areas defined by the region + Region &r = *ri; + + for (int y = r._bounds.top; y < r._bounds.bottom; ++y) { + LineSliceSet set = r.getLineSlices(y); + + for (uint p = 0; p < set.items.size(); ++p) + destSurface.hLine(set.items[p].xs - sceneBounds.left, y - sceneBounds.top, + set.items[p].xe - sceneBounds.left - 1, colIndex); + } + } + } + } + + // Release the surface + _globals->_sceneManager._scene->_backSurface.unlockSurface(); + + // Mark the scene as requiring a full redraw + _globals->_paneRefreshFlag[0] = 2; + + return false; +} + + } // End of namespace tSage diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h index c94d77b2ab..eeb5bc86f6 100644 --- a/engines/tsage/debugger.h +++ b/engines/tsage/debugger.h @@ -40,7 +40,13 @@ protected: bool Cmd_Scene(int argc, const char **argv); bool Cmd_WalkRegions(int argc, const char **argv); bool Cmd_PriorityRegions(int argc, const char **argv); - bool Cmd_Item(int argc, const char **argv); + bool Cmd_SetFlag(int argc, const char **argv); + bool Cmd_GetFlag(int argc, const char **argv); + bool Cmd_ClearFlag(int argc, const char **argv); + bool Cmd_ListObjects(int argc, const char **argv); + bool Cmd_MoveObject(int argc, const char **argv); + + bool Cmd_Hotspots(int argc, const char **argv); }; } // End of namespace tSage diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index 371166d782..ba7b459304 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -54,6 +54,10 @@ uint32 TSageEngine::getFeatures() const { return _gameDescription->features; } +Common::String TSageEngine::getPrimaryFilename() const { + return Common::String(_gameDescription->desc.filesDescriptions[0].fileName); +} + } // End of namespace tSage static const PlainGameDescriptor tSageGameTitles[] = { @@ -122,16 +126,18 @@ public: virtual SaveStateList listSaves(const char *target) const { Common::String pattern = target; - pattern += ".*"; + pattern += ".???"; Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); tSage::tSageSavegameHeader header; SaveStateList saveList; for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { - int slot; const char *ext = strrchr(file->c_str(), '.'); - if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) { + int slot = ext ? atoi(ext + 1) : -1; + + if (slot >= 0 && slot < MAX_SAVES) { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index f932c62367..d165900d55 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -39,7 +39,7 @@ static const tSageGameDescription gameDescriptions[] = { Common::GUIO_NONE }, GType_Ringworld, - GF_CD + GF_CD | GF_ALT_REGIONS }, // Ringworld First Wave English CD version { @@ -53,7 +53,7 @@ static const tSageGameDescription gameDescriptions[] = { Common::GUIO_NONE }, GType_Ringworld, - GF_CD + GF_CD | GF_ALT_REGIONS }, // Ringworld English Floppy version { @@ -69,6 +69,34 @@ static const tSageGameDescription gameDescriptions[] = { GType_Ringworld, GF_FLOPPY }, + // Ringworld English Floppy Demo #1 version + { + { + "ring", + "Floppy Demo", + AD_ENTRY1s("tsage.rlb", "bf4e8525d0cab84b08b57126092eeacd", 833453), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_DEMO, + Common::GUIO_NONE + }, + GType_Ringworld, + GF_FLOPPY | GF_DEMO + }, + // Ringworld English Floppy Demo #2 version + { + { + "ring", + "Floppy Demo", + AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206), + Common::EN_ANY, + Common::kPlatformPC, + ADGF_DEMO, + Common::GUIO_NONE + }, + GType_Ringworld, + GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS + }, // Blue Force { diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index b76d60ac48..f8e35f74f9 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -24,13 +24,16 @@ */ #include "common/translation.h" + +#include "gui/dialog.h" +#include "gui/widget.h" + #include "tsage/tsage.h" #include "tsage/core.h" #include "tsage/dialogs.h" -#include "tsage/graphics.h" -#include "tsage/core.h" #include "tsage/staticres.h" #include "tsage/globals.h" +#include "tsage/ringworld_logic.h" namespace tSage { @@ -64,23 +67,18 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String // Do post setup for the dialog setDefaults(); - // Set the dialog's centre - setCentre(_globals->_dialogCentre.x, _globals->_dialogCentre.y); + // Set the dialog's center + setCenter(_globals->_dialogCenter.x, _globals->_dialogCenter.y); } int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) { // Ensure that the cursor is the arrow - CursorType currentCursor = _globals->_events.getCursor(); - if (currentCursor != CURSOR_ARROW) - _globals->_events.setCursor(CURSOR_ARROW); + _globals->_events.pushCursor(CURSOR_ARROW); _globals->_events.showCursor(); int result = show2(message, btn1Message, btn2Message); - // If the cursor was changed, change it back - if (currentCursor != CURSOR_ARROW) - _globals->_events.setCursor(currentCursor); - + _globals->_events.popCursor(); return result; } @@ -95,7 +93,6 @@ int MessageDialog::show2(const Common::String &message, const Common::String &bt return result; } - /*--------------------------------------------------------------------------*/ ConfigDialog::ConfigDialog() : GUI::OptionsDialog("", "GlobalConfig") { @@ -139,7 +136,7 @@ void RightClickButton::highlight() { _savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds); uint size; - byte *imgData = _vm->_dataManager->getSubResource(7, 2, _buttonIndex, &size); + byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size); GfxSurface btnSelected = surfaceFromRes(imgData); _globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top); @@ -167,7 +164,7 @@ RightClickDialog::RightClickDialog() : GfxDialog(), // Set the dialog position dialogRect.resize(_surface, 0, 0, 100); - dialogRect.centre(_globals->_events._mousePos.x, _globals->_events._mousePos.y); + dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y); // Ensure the dialog will be entirely on-screen Rect screenRect = _globals->gfxManager()._bounds; @@ -379,36 +376,34 @@ bool GfxInvImage::process(Event &event) { /*--------------------------------------------------------------------------*/ -void InventoryDialog::show(bool allFlag) { - if (!allFlag) { - // Determine how many items are in the player's inventory - int itemCount = 0; - SynchronisedList<InvObject *>::iterator i; - for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) { - if ((*i)->inInventory()) - ++itemCount; - } +void InventoryDialog::show() { + // Determine how many items are in the player's inventory + int itemCount = 0; + SynchronizedList<InvObject *>::iterator i; + for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) { + if ((*i)->inInventory()) + ++itemCount; + } - if (itemCount == 0) { - MessageDialog::show(INV_EMPTY_MSG, OK_BTN_STRING); - return; - } + if (itemCount == 0) { + MessageDialog::show(INV_EMPTY_MSG, OK_BTN_STRING); + return; } - InventoryDialog *dlg = new InventoryDialog(allFlag); + InventoryDialog *dlg = new InventoryDialog(); dlg->draw(); dlg->execute(); delete dlg; } -InventoryDialog::InventoryDialog(bool allFlag) { +InventoryDialog::InventoryDialog() { // Determine the maximum size of the image of any item in the player's inventory int imgWidth = 0, imgHeight = 0; - SynchronisedList<InvObject *>::iterator i; - for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) { + SynchronizedList<InvObject *>::iterator i; + for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) { InvObject *invObject = *i; - if (allFlag || invObject->inInventory()) { + if (invObject->inInventory()) { // Get the image for the item GfxSurface itemSurface = surfaceFromRes(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum); @@ -417,10 +412,11 @@ InventoryDialog::InventoryDialog(bool allFlag) { imgHeight = MAX(imgHeight, (int)itemSurface.getBounds().height()); // Add the item to the display list - _images.push_back(GfxInvImage()); - _images[_images.size() - 1].setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum); - _images[_images.size() - 1]._invObject = invObject; - add(&_images[_images.size() - 1]); + GfxInvImage *img = new GfxInvImage(); + _images.push_back(img); + img->setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum); + img->_invObject = invObject; + add(img); } } assert(_images.size() > 0); @@ -442,7 +438,7 @@ InventoryDialog::InventoryDialog(bool allFlag) { cellX = 0; } - _images[idx]._bounds.moveTo(pt.x, pt.y); + _images[idx]->_bounds.moveTo(pt.x, pt.y); pt.x += imgWidth + 2; ++cellX; @@ -457,15 +453,21 @@ InventoryDialog::InventoryDialog(bool allFlag) { addElements(&_btnLook, &_btnOk, NULL); frame(); - setCentre(SCREEN_CENTRE_X, SCREEN_CENTRE_Y); + setCenter(SCREEN_CENTER_X, SCREEN_CENTER_Y); +} + +InventoryDialog::~InventoryDialog() { + for (uint idx = 0; idx < _images.size(); ++idx) + delete _images[idx]; } void InventoryDialog::execute() { - if ((_globals->_inventory._selectedItem) && _globals->_inventory._selectedItem->inInventory()) - _globals->_inventory._selectedItem->setCursor(); + if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory()) + RING_INVENTORY._selectedItem->setCursor(); GfxElement *hiliteObj; bool lookFlag = false; + _gfxManager.activate(); while (!_vm->getEventManager()->shouldQuit()) { // Get events @@ -491,7 +493,7 @@ void InventoryDialog::execute() { if (!event.handled && event.eventType == EVENT_KEYPRESS) { if ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { // Exit the dialog - hiliteObj = &_btnOk; + //hiliteObj = &_btnOk; break; } } @@ -513,20 +515,20 @@ void InventoryDialog::execute() { _globals->_events.setCursor(CURSOR_WALK); } - _gfxManager.activate(); hiliteObj->draw(); - _gfxManager.deactivate(); } else if (hiliteObj) { // Inventory item selected InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject; if (lookFlag) { _globals->_screenSurface.displayText(invObject->_description); } else { - _globals->_inventory._selectedItem = invObject; + RING_INVENTORY._selectedItem = invObject; invObject->setCursor(); } } } + + _gfxManager.deactivate(); } /*--------------------------------------------------------------------------*/ @@ -544,15 +546,15 @@ void OptionsDialog::show() { } } else if (btn == &dlg->_btnRestart) { // Restart game - _globals->_game.restartGame(); + _globals->_game->restartGame(); } else if (btn == &dlg->_btnSound) { // Sound dialog } else if (btn == &dlg->_btnSave) { // Save button - _globals->_game.saveGame(); + _globals->_game->saveGame(); } else if (btn == &dlg->_btnRestore) { // Restore button - _globals->_game.restoreGame(); + _globals->_game->restoreGame(); } dlg->remove(); @@ -591,7 +593,7 @@ OptionsDialog::OptionsDialog() { // Set the dialog size and position frame(); - setCentre(160, 100); + setCenter(160, 100); } diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h index 8e766372b4..c24fa2dd3b 100644 --- a/engines/tsage/dialogs.h +++ b/engines/tsage/dialogs.h @@ -105,14 +105,14 @@ public: class InventoryDialog : public ModalDialog { private: - Common::Array<GfxInvImage> _images; + Common::Array<GfxInvImage *> _images; GfxButton _btnOk, _btnLook; public: - InventoryDialog(bool allFlag = false); - virtual ~InventoryDialog() {} + InventoryDialog(); + virtual ~InventoryDialog(); void execute(); - static void show(bool allFlag = false); + static void show(); }; /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 4d2a1cce8c..e51c5da479 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -38,6 +38,7 @@ namespace tSage { EventsClass::EventsClass() { _currentCursor = CURSOR_NONE; + hideCursor(); _frameNumber = 0; _priorFrameTime = 0; _prevDelayFrame = 0; @@ -127,6 +128,9 @@ bool EventsClass::getEvent(Event &evt, int eventMask) { return true; } + evt.handled = false; + evt.eventType = EVENT_NONE; + return false; } @@ -154,27 +158,27 @@ void EventsClass::setCursor(CursorType cursorType) { uint size; switch (cursorType) { - case CURSOR_CROSSHAIRS: - // Crosshairs cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 6, &size); + case OBJECT_STUNNER: + // Stunner cursor + cursor = _resourceManager->getSubResource(4, 1, 6, &size); _globals->setFlag(122); break; case CURSOR_LOOK: // Look cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 5, &size); + cursor = _resourceManager->getSubResource(4, 1, 5, &size); _currentCursor = CURSOR_LOOK; break; case CURSOR_USE: // Use cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 4, &size); + cursor = _resourceManager->getSubResource(4, 1, 4, &size); _currentCursor = CURSOR_USE; break; case CURSOR_TALK: // Talk cursor - cursor = _vm->_dataManager->getSubResource(4, 1, 3, &size); + cursor = _resourceManager->getSubResource(4, 1, 3, &size); _currentCursor = CURSOR_TALK; break; @@ -198,16 +202,72 @@ void EventsClass::setCursor(CursorType cursorType) { Graphics::Surface surface = s.lockSurface(); const byte *cursorData = (const byte *)surface.getBasePtr(0, 0); - CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColour); + CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor); s.unlockSurface(); if (delFlag) DEALLOCATE(cursor); } -void EventsClass::setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId) { +void EventsClass::pushCursor(CursorType cursorType) { + const byte *cursor; + bool delFlag = true; + uint size; + + switch (cursorType) { + case CURSOR_CROSSHAIRS: + // Crosshairs cursor + cursor = _resourceManager->getSubResource(4, 1, 6, &size); + break; + + case CURSOR_LOOK: + // Look cursor + cursor = _resourceManager->getSubResource(4, 1, 5, &size); + break; + + case CURSOR_USE: + // Use cursor + cursor = _resourceManager->getSubResource(4, 1, 4, &size); + break; + + case CURSOR_TALK: + // Talk cursor + cursor = _resourceManager->getSubResource(4, 1, 3, &size); + break; + + case CURSOR_ARROW: + // Arrow cursor + cursor = CURSOR_ARROW_DATA; + delFlag = false; + break; + + case CURSOR_WALK: + default: + // Walk cursor + cursor = CURSOR_WALK_DATA; + delFlag = false; + break; + } + + // Decode the cursor + GfxSurface s = surfaceFromRes(cursor); + + Graphics::Surface surface = s.lockSurface(); + const byte *cursorData = (const byte *)surface.getBasePtr(0, 0); + CursorMan.pushCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor); + s.unlockSurface(); + + if (delFlag) + DEALLOCATE(cursor); +} + +void EventsClass::popCursor() { + CursorMan.popCursor(); +} + +void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId) { const byte *cursorData = (const byte *)cursor.getBasePtr(0, 0); - CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColour); + CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColor); _currentCursor = cursorId; } @@ -224,6 +284,10 @@ void EventsClass::hideCursor() { CursorMan.showMouse(false); } +bool EventsClass::isCursorVisible() const { + return CursorMan.isVisible(); +} + /** * Delays the game for the specified number of frames, if necessary, from the * previous time the delay method was called diff --git a/engines/tsage/events.h b/engines/tsage/events.h index 202ac9ccd2..d2dbd9e058 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -82,11 +82,14 @@ public: CursorType _currentCursor; void setCursor(CursorType cursorType); - void setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId); + void pushCursor(CursorType cursorType); + void popCursor(); + void setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId); void setCursorFromFlag(); CursorType getCursor() const { return _currentCursor; } void showCursor(); void hideCursor(); + bool isCursorVisible() const; bool pollEvent(); void waitForPress(int eventMask = EVENT_BUTTON_DOWN | EVENT_KEYPRESS); @@ -97,10 +100,10 @@ public: uint32 getFrameNumber() const { return _frameNumber; } void delay(int numFrames); - virtual void listenerSynchronise(Serialiser &s) { + virtual void listenerSynchronize(Serializer &s) { s.syncAsUint32LE(_frameNumber); s.syncAsUint32LE(_prevDelayFrame); - // TODO: Synchronise unknown stuff + // TODO: Synchronize unknown stuff } }; diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index b9abb9d751..c6e1344714 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -24,10 +24,13 @@ */ #include "tsage/globals.h" +#include "tsage/tsage.h" +#include "tsage/ringworld_logic.h" namespace tSage { Globals *_globals = NULL; +ResourceManager *_resourceManager = NULL; /*--------------------------------------------------------------------------*/ @@ -40,23 +43,34 @@ static SavedObject *classFactoryProc(const Common::String &className) { if (className == "ObjectMover2") return new ObjectMover2(); if (className == "ObjectMover3") return new ObjectMover3(); if (className == "PlayerMover") return new PlayerMover(); - + if (className == "SceneObjectWrapper") return new SceneObjectWrapper(); + if (className == "PaletteRotation") return new PaletteRotation(); + if (className == "PaletteFader") return new PaletteFader(); return NULL; } /*--------------------------------------------------------------------------*/ Globals::Globals() : - _dialogCentre(160, 140), + _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface) { reset(); _stripNum = 0; - _gfxFontNumber = 50; - _gfxColours.background = 53; - _gfxColours.foreground = 18; - _fontColours.background = 51; - _fontColours.foreground = 54; + if (_vm->getFeatures() & GF_DEMO) { + _gfxFontNumber = 0; + _gfxColors.background = 6; + _gfxColors.foreground = 0; + _fontColors.background = 0; + _fontColors.foreground = 0; + _dialogCenter.y = 80; + } else { + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 18; + _fontColors.background = 51; + _fontColors.foreground = 54; + } _screenSurface.setScreenSurface(); _gfxManagers.push_back(&_gfxManagerInstance); @@ -66,10 +80,22 @@ Globals::Globals() : _prevSceneOffset = Common::Point(-1, -1); _sceneListeners.push_back(&_soundHandler); _sceneListeners.push_back(&_sequenceManager._soundHandler); + + _scrollFollower = NULL; + _inventory = NULL; + + if (!(_vm->getFeatures() & GF_DEMO)) { + _inventory = new RingworldInvObjectList(); + _game = new RingworldGame(); + } else { + _game = new RingworldDemoGame(); + } } Globals::~Globals() { _globals = NULL; + delete _inventory; + delete _game; } void Globals::reset() { @@ -77,20 +103,22 @@ void Globals::reset() { _saver->addFactory(classFactoryProc); } -void Globals::synchronise(Serialiser &s) { +void Globals::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + SavedObject::synchronize(s); assert(_gfxManagers.size() == 1); - _sceneItems.synchronise(s); + _sceneItems.synchronize(s); SYNC_POINTER(_sceneObjects); - _sceneObjects_queue.synchronise(s); + _sceneObjects_queue.synchronize(s); s.syncAsSint32LE(_gfxFontNumber); - s.syncAsSint32LE(_gfxColours.background); - s.syncAsSint32LE(_gfxColours.foreground); - s.syncAsSint32LE(_fontColours.background); - s.syncAsSint32LE(_fontColours.foreground); + s.syncAsSint32LE(_gfxColors.background); + s.syncAsSint32LE(_gfxColors.foreground); + s.syncAsSint32LE(_fontColors.background); + s.syncAsSint32LE(_fontColors.foreground); - s.syncAsSint16LE(_dialogCentre.x); s.syncAsSint16LE(_dialogCentre.y); - _sceneListeners.synchronise(s); + s.syncAsSint16LE(_dialogCenter.x); s.syncAsSint16LE(_dialogCenter.y); + _sceneListeners.synchronize(s); for (int i = 0; i < 256; ++i) s.syncAsByte(_flags[i]); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 59afe140a0..3a6fab5b70 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -41,7 +41,7 @@ public: GfxManager _gfxManagerInstance; Common::List<GfxManager *> _gfxManagers; SceneHandler _sceneHandler; - Game _game; + Game *_game; EventsClass _events; SceneManager _sceneManager; ScenePalette _scenePalette; @@ -49,19 +49,19 @@ public: SceneItemList _sceneItems; SceneObjectList _sceneObjectsInstance; SceneObjectList *_sceneObjects; - SynchronisedList<SceneObjectList *> _sceneObjects_queue; + SynchronizedList<SceneObjectList *> _sceneObjects_queue; SceneText _sceneText; int _gfxFontNumber; - GfxColours _gfxColours; - GfxColours _fontColours; + GfxColors _gfxColors; + GfxColors _fontColors; SoundManager _soundManager; - Common::Point _dialogCentre; + Common::Point _dialogCenter; WalkRegions _walkRegions; - SynchronisedList<EventHandler *> _sceneListeners; + SynchronizedList<EventHandler *> _sceneListeners; bool _flags[256]; Player _player; SoundHandler _soundHandler; - InvObjectList _inventory; + InvObjectList *_inventory; Region _paneRegions[2]; int _paneRefreshFlag[2]; Common::Point _sceneOffset; @@ -90,11 +90,15 @@ public: GfxManager &gfxManager() { return **_gfxManagers.begin(); } virtual Common::String getClassName() { return "Globals"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); }; extern Globals *_globals; +// Note: Currently this can't be part of the _globals structure, since it needs to be constructed +// prior to many of the fields in Globals execute their constructors +extern ResourceManager *_resourceManager; + } // End of namespace tSage #endif diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 641e10b3e9..c50da6beef 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -29,6 +29,7 @@ #include "tsage/tsage.h" #include "tsage/core.h" #include "common/algorithm.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "tsage/globals.h" @@ -72,7 +73,7 @@ GfxSurface surfaceFromRes(const byte *imgData) { s.create(r.width(), r.height()); s._centroid.x = READ_LE_UINT16(imgData + 4); s._centroid.y = READ_LE_UINT16(imgData + 6); - s._transColour = *(imgData + 8); + s._transColor = *(imgData + 8); bool rleEncoded = (imgData[9] & 2) != 0; @@ -83,7 +84,7 @@ GfxSurface surfaceFromRes(const byte *imgData) { if (!rleEncoded) { Common::copy(srcP, srcP + (r.width() * r.height()), destP); } else { - Common::set_to(destP, destP + (r.width() * r.height()), s._transColour); + Common::set_to(destP, destP + (r.width() * r.height()), s._transColor); for (int yp = 0; yp < r.height(); ++yp) { int width = r.width(); @@ -122,7 +123,7 @@ GfxSurface surfaceFromRes(const byte *imgData) { GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) { uint size; - byte *imgData = _vm->_dataManager->getSubResource(resNum, rlbNum, subNum, &size); + byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size); GfxSurface surface = surfaceFromRes(imgData); DEALLOCATE(imgData); @@ -147,22 +148,22 @@ void Rect::collapse(int dx, int dy) { } /** - * Centres the rectangle at a given position + * Centers the rectangle at a given position * - * @xp x position for new centre - * @yp y position for new centre + * @xp x position for new center + * @yp y position for new center */ -void Rect::centre(int xp, int yp) { +void Rect::center(int xp, int yp) { moveTo(xp - (width() / 2), yp - (height() / 2)); } /** - * Centres the rectangle at the centre of a second passed rectangle + * Centers the rectangle at the center of a second passed rectangle * - * @r Second rectangle whose centre to use + * @r Second rectangle whose center to use */ -void Rect::centre(const Rect &r) { - centre(r.left + (r.width() / 2), r.top + (r.height() / 2)); +void Rect::center(const Rect &r) { + center(r.left + (r.width() / 2), r.top + (r.height() / 2)); } /* @@ -211,7 +212,7 @@ void Rect::expandPanes() { /** * Serialises the given rect */ -void Rect::synchronise(Serialiser &s) { +void Rect::synchronize(Serializer &s) { s.syncAsSint16LE(left); s.syncAsSint16LE(top); s.syncAsSint16LE(right); @@ -226,6 +227,7 @@ GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) { _lockSurfaceCtr = 0; _customSurface = NULL; _screenSurfaceP = NULL; + _transColor = -1; } GfxSurface::GfxSurface(const GfxSurface &s) { @@ -256,8 +258,13 @@ void GfxSurface::setScreenSurface() { void GfxSurface::create(int width, int height) { assert((width >= 0) && (height >= 0)); _screenSurface = false; + if (_customSurface) { + _customSurface->free(); + delete _customSurface; + } _customSurface = new Graphics::Surface(); - _customSurface->create(width, height, 1); + _customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + Common::set_to((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0); _bounds = Rect(0, 0, width, height); } @@ -282,7 +289,7 @@ Graphics::Surface GfxSurface::lockSurface() { result.w = _bounds.width(); result.h = _bounds.height(); result.pitch = src->pitch; - result.bytesPerPixel = src->bytesPerPixel; + result.format = src->format; result.pixels = src->getBasePtr(_bounds.left, _bounds.top); return result; @@ -301,14 +308,14 @@ void GfxSurface::unlockSurface() { } /** - * Fills a specified rectangle on the surface with the specified colour + * Fills a specified rectangle on the surface with the specified color * * @bounds Area to fill - * @colour Colour to use + * @color Color to use */ -void GfxSurface::fillRect(const Rect &bounds, int colour) { +void GfxSurface::fillRect(const Rect &bounds, int color) { Graphics::Surface surface = lockSurface(); - surface.fillRect(bounds, colour); + surface.fillRect(bounds, color); unlockSurface(); } @@ -326,12 +333,12 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) { _disableUpdates = s._disableUpdates; _bounds = s._bounds; _centroid = s._centroid; - _transColour = s._transColour; + _transColor = s._transColor; if (_customSurface) { // Surface owns the internal data, so replicate it so new surface owns it's own _customSurface = new Graphics::Surface(); - _customSurface->create(s._customSurface->w, s._customSurface->h, 1); + _customSurface->create(s._customSurface->w, s._customSurface->h, Graphics::PixelFormat::createFormatCLUT8()); const byte *srcP = (const byte *)s._customSurface->getBasePtr(0, 0); byte *destP = (byte *)_customSurface->getBasePtr(0, 0); @@ -348,14 +355,14 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt) // Set up a new graphics manager GfxManager gfxManager; gfxManager.activate(); - gfxManager._font._colours.background = 0; - gfxManager._font._colours.foreground = 7; + gfxManager._font._colors.background = 0; + gfxManager._font._colors.foreground = 7; gfxManager._font.setFontNumber(2); // Get the area for text display Rect textRect; gfxManager.getStringBounds(msg.c_str(), textRect, 200); - textRect.centre(pt.x, pt.y); + textRect.center(pt.x, pt.y); // Make a backup copy of the area the text will occupy Rect saveRect = textRect; @@ -390,7 +397,7 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf if (xSection < xHalfCount && ySection < yHalfCount) { int rlbNum = xSection * yHalfCount + ySection; - byte *data = _vm->_dataManager->getResource(RES_BITMAP, screenNum, rlbNum); + byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum); for (int y = 0; y < updateRect.height(); ++y) { byte *pSrc = data + y * 160; @@ -410,19 +417,20 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf * included in a scaled image */ static int *scaleLine(int size, int srcSize) { - int scale = 100 * size / srcSize; + const int PRECISION_FACTOR = 1000; + int scale = PRECISION_FACTOR * size / srcSize; assert(scale >= 0); int *v = new int[size]; - Common::set_to(v, &v[size], 0); + Common::set_to(v, &v[size], -1); - int distCtr = 0; + int distCtr = PRECISION_FACTOR / 2; int *destP = v; for (int distIndex = 0; distIndex < srcSize; ++distIndex) { distCtr += scale; - while (distCtr >= 100) { + while (distCtr > PRECISION_FACTOR) { assert(destP < &v[size]); *destP++ = distIndex; - distCtr -= 100; + distCtr -= PRECISION_FACTOR; } } @@ -436,7 +444,7 @@ static int *scaleLine(int size, int srcSize) { * @param NewHeight New height for scaled image * @remarks Caller is responsible for freeing the returned surface */ -static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) { +static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize, int transIndex) { GfxSurface s; s.create(xSize, ySize); @@ -448,12 +456,22 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) { // Loop to create scaled version for (int yp = 0; yp < ySize; ++yp) { - const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]); byte *destP = (byte *)destImage.getBasePtr(0, yp); - for (int xp = 0; xp < xSize; ++xp) { - const byte *tempSrcP = srcP + horizUsage[xp]; - *destP++ = *tempSrcP++; + if (vertUsage[yp] == -1) { + Common::set_to(destP, destP + xSize, transIndex); + } else { + const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]); + + for (int xp = 0; xp < xSize; ++xp) { + if (horizUsage[xp] != -1) { + const byte *tempSrcP = srcP + horizUsage[xp]; + *destP++ = *tempSrcP++; + } else { + // Pixel overrun at the end of the line + *destP++ = transIndex; + } + } } } @@ -472,6 +490,8 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) { */ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Region *priorityRegion) { GfxSurface srcImage; + if (srcBounds.isEmpty()) + return; if (srcBounds == src.getBounds()) srcImage = src; @@ -493,7 +513,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi } if ((destBounds.width() != srcBounds.width()) || (destBounds.height() != srcBounds.height())) - srcImage = ResizeSurface(srcImage, destBounds.width(), destBounds.height()); + srcImage = ResizeSurface(srcImage, destBounds.width(), destBounds.height(), src._transColor); Graphics::Surface srcSurface = srcImage.lockSurface(); Graphics::Surface destSurface = lockSurface(); @@ -519,7 +539,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi for (int y = 0; y < destBounds.height(); ++y, pSrc += srcSurface.pitch, pDest += destSurface.pitch) { - if (!priorityRegion && (src._transColour == -1)) + if (!priorityRegion && (src._transColor == -1)) Common::copy(pSrc, pSrc + destBounds.width(), pDest); else { const byte *tempSrc = pSrc; @@ -530,7 +550,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi if (!priorityRegion || !priorityRegion->contains(Common::Point( xp + _globals->_sceneManager._scene->_sceneBounds.left, destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) { - if (*tempSrc != src._transColour) + if (*tempSrc != src._transColor) *tempDest = *tempSrc; } ++tempSrc; @@ -570,8 +590,8 @@ GfxElement::GfxElement() { void GfxElement::setDefaults() { _flags = 0; _fontNumber = _globals->_gfxFontNumber; - _colours = _globals->_gfxColours; - _fontColours = _globals->_fontColours; + _colors = _globals->_gfxColors; + _fontColors = _globals->_fontColors; } /** @@ -583,15 +603,15 @@ void GfxElement::highlight() { Graphics::Surface surface = gfxManager.lockSurface(); // Scan through the contents of the element, switching any occurances of the foreground - // colour with the background colour and vice versa + // color with the background color and vice versa Rect tempRect(_bounds); tempRect.collapse(2, 2); for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) { byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp); for (int xp = tempRect.left; xp < tempRect.right; ++xp, ++lineP) { - if (*lineP == _colours.background) *lineP = _colours.foreground; - else if (*lineP == _colours.foreground) *lineP = _colours.background; + if (*lineP == _colors.background) *lineP = _colors.foreground; + else if (*lineP == _colors.foreground) *lineP = _colors.background; } } @@ -607,31 +627,31 @@ void GfxElement::drawFrame() { GfxManager &gfxManager = _globals->gfxManager(); gfxManager.lockSurface(); - uint8 bgColour, fgColour; + uint8 bgColor, fgColor; if (_flags & GFXFLAG_THICK_FRAME) { - bgColour = 0; - fgColour = 0; + bgColor = 0; + fgColor = 0; } else { - bgColour = _fontColours.background; - fgColour = _fontColours.foreground; + bgColor = _fontColors.background; + fgColor = _fontColors.foreground; } Rect tempRect = _bounds; tempRect.collapse(3, 3); tempRect.collapse(-1, -1); - gfxManager.fillRect(tempRect, _colours.background); + gfxManager.fillRect(tempRect, _colors.background); --tempRect.bottom; --tempRect.right; - gfxManager.fillArea(tempRect.left, tempRect.top, bgColour); - gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColour); - gfxManager.fillArea(tempRect.right, tempRect.top, fgColour); - gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColour); + gfxManager.fillArea(tempRect.left, tempRect.top, bgColor); + gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.top, fgColor); + gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor); tempRect.collapse(-1, -1); - gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColour); - gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColour); - gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColour); - gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColour); + gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor); + gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor); + gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor); + gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor); gfxManager.fillArea(tempRect.left, tempRect.top, 0); gfxManager.fillArea(tempRect.left, tempRect.bottom, 0); @@ -702,7 +722,7 @@ void GfxImage::setDefaults() { // Decode the image uint size; - byte *imgData = _vm->_dataManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size); + byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size); _surface = surfaceFromRes(imgData); DEALLOCATE(imgData); @@ -753,10 +773,10 @@ void GfxMessage::draw() { GfxFontBackup font; GfxManager &gfxManager = _globals->gfxManager(); - // Set the font and colour + // Set the font and color gfxManager.setFillFlag(false); gfxManager._font.setFontNumber(_fontNumber); - gfxManager._font._colours.foreground = this->_colours.foreground; + gfxManager._font._colors.foreground = this->_colors.foreground; // Display the text gfxManager._font.writeLines(_message.c_str(), _bounds, _textAlign); @@ -791,14 +811,14 @@ void GfxButton::draw() { // Draw a basic frame for the button drawFrame(); - // Set the font and colour + // Set the font and color gfxManager._font.setFontNumber(_fontNumber); - gfxManager._font._colours.foreground = this->_colours.foreground; + gfxManager._font._colors.foreground = this->_colors.foreground; // Display the button's text Rect tempRect(_bounds); tempRect.collapse(3, 3); - gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTRE); + gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER); gfxManager.unlockSurface(); } @@ -928,7 +948,7 @@ void GfxDialog::setTopLeft(int xp, int yp) { _bounds.moveTo(xp - 6, yp - 6); } -void GfxDialog::setCentre(int xp, int yp) { +void GfxDialog::setCenter(int xp, int yp) { setTopLeft(xp - (_bounds.width() / 2), yp - (_bounds.height() / 2)); } @@ -986,9 +1006,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { void GfxDialog::setPalette() { _globals->_scenePalette.loadPalette(0); _globals->_scenePalette.setPalette(0, 1); - _globals->_scenePalette.setPalette(_globals->_scenePalette._colours.foreground, 1); - _globals->_scenePalette.setPalette(_globals->_fontColours.background, 1); - _globals->_scenePalette.setPalette(_globals->_fontColours.foreground, 1); + _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1); _globals->_scenePalette.setPalette(255, 1); } @@ -1013,7 +1033,7 @@ void GfxManager::setDefaults() { _pane0Rect4 = screenBounds; _font._edgeSize = Common::Point(1, 1); - _font._colours = _globals->_fontColours; + _font._colors = _globals->_fontColors; _font.setFontNumber(_globals->_gfxFontNumber); } @@ -1040,20 +1060,20 @@ void GfxManager::getStringBounds(const char *s, Rect &bounds, int maxWidth) { _font.getStringBounds(s, bounds, maxWidth); } -void GfxManager::fillArea(int xp, int yp, int colour) { +void GfxManager::fillArea(int xp, int yp, int color) { _surface.setBounds(_bounds); Rect tempRect(xp, yp, xp + _font._edgeSize.x, yp + _font._edgeSize.y); - _surface.fillRect(tempRect, colour); + _surface.fillRect(tempRect, color); } -void GfxManager::fillRect(const Rect &bounds, int colour) { +void GfxManager::fillRect(const Rect &bounds, int color) { _surface.setBounds(_bounds); - _surface.fillRect(bounds, colour); + _surface.fillRect(bounds, color); } -void GfxManager::fillRect2(int xs, int ys, int width, int height, int colour) { +void GfxManager::fillRect2(int xs, int ys, int width, int height, int color) { _surface.setBounds(_bounds); - _surface.fillRect(Rect(xs, ys, xs + width, ys + height), colour); + _surface.fillRect(Rect(xs, ys, xs + width, ys + height), color); } /** @@ -1061,10 +1081,10 @@ void GfxManager::fillRect2(int xs, int ys, int width, int height, int colour) { */ void GfxManager::setDialogPalette() { // Get the main palette information - RGB8 palData[256]; + byte palData[256 * 3]; uint count, start; - _vm->_dataManager->getPalette(0, &palData[0], &start, &count); - g_system->getPaletteManager()->setPalette((byte *)&palData[0], start, count); + _resourceManager->getPalette(0, &palData[0], &start, &count); + g_system->getPaletteManager()->setPalette(&palData[0], start, count); // Miscellaneous uint32 white = 0xffffffff; @@ -1098,7 +1118,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) { GfxFont::GfxFont() { - _fontNumber = 50; + _fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50; _numChars = 0; _bpp = 0; _fontData = NULL; @@ -1122,9 +1142,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) { _fontNumber = fontNumber; - _fontData = _vm->_tSageManager->getResource(RES_FONT, _fontNumber, 0, true); + _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true); if (!_fontData) - _fontData = _vm->_dataManager->getResource(RES_FONT, _fontNumber, 0); + _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0); _numChars = READ_LE_UINT16(_fontData + 4); _fontSize.y = READ_LE_UINT16(_fontData + 6); @@ -1268,7 +1288,7 @@ int GfxFont::writeChar(const char ch) { charRect.translate(_topLeft.x + _position.x, _topLeft.y + _position.y + yOffset); if (_fillFlag) - surfacePtr.fillRect(charRect, _colours.background); + surfacePtr.fillRect(charRect, _colors.background); charRect.bottom = charRect.top + charHeight; @@ -1279,7 +1299,7 @@ int GfxFont::writeChar(const char ch) { byte *destP = (byte *)surfacePtr.getBasePtr(charRect.left, yp); for (int xs = 0; xs < charRect.width(); ++xs, ++destP) { - // Get the next colour index to use + // Get the next color index to use if ((bitCtr % 8) == 0) v = *dataP++; int colIndex = 0; for (int subCtr = 0; subCtr < _bpp; ++subCtr, ++bitCtr) { @@ -1288,10 +1308,10 @@ int GfxFont::writeChar(const char ch) { } switch (colIndex) { - //case 0: *destP = _colours.background; break; - case 1: *destP = _colours.foreground; break; - case 2: *destP = _colours2.background; break; - case 3: *destP = _colours2.foreground; break; + //case 0: *destP = _colors.background; break; + case 1: *destP = _colors.foreground; break; + case 2: *destP = _colors2.background; break; + case 3: *destP = _colors2.foreground; break; } } } @@ -1355,7 +1375,7 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) { writeString(s, numChars); break; - case ALIGN_CENTRE: + case ALIGN_CENTER: // Center aligned text _position.x = bounds.left + (bounds.width() / 2) - (getStringWidth(s, numChars) / 2); writeString(s, numChars); @@ -1415,7 +1435,7 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) { GfxFontBackup::GfxFontBackup() { _edgeSize = _globals->gfxManager()._font._edgeSize; _position = _globals->gfxManager()._font._position; - _colours = _globals->gfxManager()._font._colours; + _colors = _globals->gfxManager()._font._colors; _fontNumber = _globals->gfxManager()._font._fontNumber; } @@ -1423,7 +1443,7 @@ GfxFontBackup::~GfxFontBackup() { _globals->gfxManager()._font.setFontNumber(_fontNumber); _globals->gfxManager()._font._edgeSize = _edgeSize; _globals->gfxManager()._font._position = _position; - _globals->gfxManager()._font._colours = _colours; + _globals->gfxManager()._font._colors = _colors; } diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 0ad76772b3..8be4629493 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -48,22 +48,22 @@ public: void set(int16 x1, int16 y1, int16 x2, int16 y2); void collapse(int dx, int dy); - void centre(int dx, int dy); - void centre(const Rect &r); - void centre(const Common::Point &pt) { centre(pt.x, pt.y); } + void center(int dx, int dy); + void center(const Rect &r); + void center(const Common::Point &pt) { center(pt.x, pt.y); } void contain(const Rect &r); void resize(const GfxSurface &surface, int xp, int yp, int percent); void expandPanes(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); }; -class GfxColours { +class GfxColors { public: uint8 foreground; uint8 background; - GfxColours() : foreground(0), background(0) {}; + GfxColors() : foreground(0), background(0) {}; }; class LineSlice { @@ -85,7 +85,7 @@ private: Rect _bounds; public: Common::Point _centroid; - int _transColour; + int _transColor; public: GfxSurface(); GfxSurface(const GfxSurface &s); @@ -108,14 +108,14 @@ public: copyFrom(src, tempRect, priorityRegion); } void draw(const Common::Point &pt, Rect *rect = NULL); - void fillRect(const Rect &bounds, int colour); + void fillRect(const Rect &bounds, int color); GfxSurface &operator=(const GfxSurface &s); static void loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection); static bool displayText(const Common::String &msg, const Common::Point &pt = Common::Point(160, 100)); }; -enum TextAlign {ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2, ALIGN_JUSTIFIED = 3}; +enum TextAlign {ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2, ALIGN_JUSTIFIED = 3}; class GfxFont { friend class GfxFontBackup; @@ -131,8 +131,8 @@ public: Common::Point _edgeSize; Common::Point _position; bool _fillFlag; - GfxColours _colours; - GfxColours _colours2; + GfxColors _colors; + GfxColors _colors2; uint32 _fontNumber; Common::Point _topLeft; public: @@ -160,7 +160,7 @@ private: GfxSurface *_surface; Common::Point _edgeSize; Common::Point _position; - GfxColours _colours; + GfxColors _colors; uint32 _fontNumber; public: GfxFontBackup(); @@ -177,8 +177,8 @@ public: Rect _bounds; uint16 _flags; uint16 _fontNumber; - GfxColours _colours; - GfxColours _fontColours; + GfxColors _colors; + GfxColors _fontColors; uint16 _keycode; public: GfxElement(); @@ -275,19 +275,19 @@ public: return _surface.lockSurface(); } void unlockSurface() { _surface.unlockSurface(); }; - void fillArea(int xp, int yp, int colour); - void fillRect(const Rect &bounds, int colour); - void fillRect2(int xs, int ys, int width, int height, int colour); + void fillArea(int xp, int yp, int color); + void fillRect(const Rect &bounds, int color); + void fillRect2(int xs, int ys, int width, int height, int color); void setFillFlag(bool v) { _font._fillFlag = v; } static int getAngle(const Common::Point &p1, const Common::Point &p2); // Virtual method table - virtual void xorArea(const Common::Rect &r, int colour, int fillMode) { - //_surface->xorArea(r, colour, fillMode); + virtual void xorArea(const Common::Rect &r, int color, int fillMode) { + //_surface->xorArea(r, color, fillMode); } - virtual void draw(const Common::Rect &r, void *gfxData, int v1, GfxColours *colours) { - //_surface->draw(r, gfxData, v1, colours); + virtual void draw(const Common::Rect &r, void *gfxData, int v1, GfxColors *colors) { + //_surface->draw(r, gfxData, v1, colors); } virtual void copy(const byte *src, byte *dest, int size) { Common::copy(src, src + size, dest); @@ -325,7 +325,7 @@ public: void add(GfxElement *element); void addElements(GfxElement *ge, ...); void setTopLeft(int xp, int yp); - void setCentre(int xp, int yp); + void setCenter(int xp, int yp); void frame() { setDefaults(); _bounds.collapse(6, 6); diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 41a868195b..2f9194a9ba 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ globals.o \ graphics.o \ resources.o \ + ringworld_demo.o \ ringworld_logic.o \ ringworld_scenes1.o \ ringworld_scenes2.o \ diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp index c87c3eaf1e..2b678a848a 100644 --- a/engines/tsage/resources.cpp +++ b/engines/tsage/resources.cpp @@ -29,6 +29,7 @@ #include "common/stack.h" #include "common/util.h" #include "tsage/resources.h" +#include "tsage/tsage.h" namespace tSage { @@ -134,7 +135,7 @@ uint16 BitReader::readToken() { /*-------------------------------------------------------------------------*/ -RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename) : +TLib::TLib(MemoryManager &memManager, const Common::String &filename) : _memoryManager(memManager) { // If the resource strings list isn't yet loaded, load them @@ -154,11 +155,11 @@ RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename) loadIndex(); } -RlbManager::~RlbManager() { +TLib::~TLib() { _resStrings.clear(); } -void RlbManager::loadSection(uint32 fileOffset) { +void TLib::loadSection(uint32 fileOffset) { _resources.clear(); _file.seek(fileOffset); _sections.fileOffset = fileOffset; @@ -197,13 +198,13 @@ struct DecodeReference { /** * Gets a resource from the currently loaded section */ -byte *RlbManager::getResource(uint16 id, bool suppressErrors) { +byte *TLib::getResource(uint16 id, bool suppressErrors) { // Scan for an entry for the given Id - ResourceEntry *re= NULL; - ResourceList::iterator i; - for (i = _resources.begin(); i != _resources.end(); ++i) { - if ((*i).id == id) { - re = &(*i); + ResourceEntry *re = NULL; + ResourceList::iterator iter; + for (iter = _resources.begin(); iter != _resources.end(); ++iter) { + if ((*iter).id == id) { + re = &(*iter); break; } } @@ -238,6 +239,9 @@ byte *RlbManager::getResource(uint16 id, bool suppressErrors) { uint16 word_48050 = 0, currentToken = 0, word_48054 =0; byte byte_49068 = 0, byte_49069 = 0; DecodeReference table[0x1000]; + for (int i = 0; i < 0x1000; ++i) { + table[i].vByte = table[i].vWord = 0; + } Common::Stack<uint16> tokenList; for (;;) { @@ -307,7 +311,7 @@ byte *RlbManager::getResource(uint16 id, bool suppressErrors) { /** * Finds the correct section and loads the specified resource within it */ -byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { +byte *TLib::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { SectionList::iterator i = _sections.begin(); while ((i != _sections.end()) && ((*i).resType != resType || (*i).resNum != resNum)) ++i; @@ -322,7 +326,7 @@ byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum return getResource(rlbNum, suppressErrors); } -void RlbManager::loadIndex() { +void TLib::loadIndex() { uint16 resNum, configId, fileOffset; // Load the root resources section @@ -356,26 +360,32 @@ void RlbManager::loadIndex() { * * @paletteNum Specefies the palette number */ -void RlbManager::getPalette(int paletteNum, RGB8 *palData, uint *startNum, uint *numEntries) { +bool TLib::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries) { // Get the specified palette - byte *dataIn = getResource(RES_PALETTE, 0, paletteNum); - assert(dataIn); + byte *dataIn = getResource(RES_PALETTE, 0, paletteNum, true); + if (!dataIn) + return false; *startNum = READ_LE_UINT16(dataIn); *numEntries = READ_LE_UINT16(dataIn + 2); - RGB8 *srcPal = (RGB8 *)(dataIn + 6); assert((*startNum < 256) && ((*startNum + *numEntries) <= 256)); // Copy over the data - Common::copy(&srcPal[0], &srcPal[*numEntries], palData); + Common::copy(&dataIn[6], &dataIn[6 + *numEntries * 3], palData); _memoryManager.deallocate(dataIn); + return true; } -byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size) { +byte *TLib::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) { // Get the specified image set byte *dataIn = getResource(RES_VISAGE, resNum, rlbNum); - assert(dataIn); + if (!dataIn) { + if (suppressErrors) + return NULL; + + error("Unknown sub resource %d/%d index %d", resNum, rlbNum, index); + } int numEntries = READ_LE_UINT16(dataIn); uint32 entryOffset = READ_LE_UINT32(dataIn + 2 + (index - 1) * 4); @@ -394,16 +404,97 @@ byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size) /** * Retrieves a given message resource, and returns the specified message number */ -Common::String RlbManager::getMessage(int resNum, int lineNum) { - byte *msgData = getResource(RES_MESSAGE, resNum, 0); - assert(msgData); +bool TLib::getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors) { + byte *msgData = getResource(RES_MESSAGE, resNum, 0, true); + if (!msgData) { + if (suppressErrors) + return false; + + error("Unknown message %d line %d", resNum, lineNum); + } const char *srcP = (const char *)msgData; while (lineNum-- > 0) srcP += strlen(srcP) + 1; - Common::String result(srcP); + result = Common::String(srcP); _memoryManager.deallocate(msgData); + return true; +} + +/*--------------------------------------------------------------------------*/ + +ResourceManager::~ResourceManager() { + for (uint idx = 0; idx < _libList.size(); ++idx) + delete _libList[idx]; +} + +void ResourceManager::addLib(const Common::String &libName) { + assert(_libList.size() < 5); + + _libList.push_back(new TLib(_vm->_memoryManager, libName)); +} + +byte *ResourceManager::getResource(uint16 id, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getResource(id, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Could not find resource Id #%d", id); + return NULL; +} + +byte *ResourceManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getResource(resType, resNum, rlbNum, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Unknown resource type %d num %d", resType, resNum); + return NULL; +} + +void ResourceManager::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors) { + for (uint idx = 0; idx < _libList.size(); ++idx) { + if (_libList[idx]->getPalette(paletteNum, palData, startNum, numEntries)) + return; + } + + if (!suppressErrors) + error("Unknown palette resource %d", paletteNum); + *numEntries = 0; +} + +byte *ResourceManager::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) { + byte *result = NULL; + for (uint idx = 0; idx < _libList.size(); ++idx) { + result = _libList[idx]->getSubResource(resNum, rlbNum, index, size, true); + if (result) + return result; + } + + if (!result && !suppressErrors) + error("Unknown resource %d/%d index %d", resNum, rlbNum, index); + return NULL; +} + +Common::String ResourceManager::getMessage(int resNum, int lineNum, bool suppressErrors) { + Common::String result; + + for (uint idx = 0; idx < _libList.size(); ++idx) { + if (_libList[idx]->getMessage(resNum, lineNum, result, true)) + return result; + } + + if (!suppressErrors) + error("Unknown message %d line %d", resNum, lineNum); return result; } diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h index 1af1bb8d2f..7b518cabd6 100644 --- a/engines/tsage/resources.h +++ b/engines/tsage/resources.h @@ -27,10 +27,12 @@ #define RING_RESOURCES_H #include "common/scummsys.h" +#include "common/array.h" #include "common/file.h" #include "common/list.h" #include "common/str.h" #include "common/str-array.h" +#include "common/textconsole.h" #include "common/util.h" #include "graphics/surface.h" @@ -45,16 +47,6 @@ enum ResourceType { RES_LIBRARY, RES_STRIP, RES_IMAGE, RES_PALETTE, RES_VISAGE, RES_FONT, RES_POINTER, RES_BANK, RES_SND_DRIVER, RES_PRIORITY, RES_CONTROL, RES_WALKRGNS, RES_BITMAP, RES_SAVE, RES_SEQUENCE }; -#include "common/pack-start.h" // START STRUCT PACKING - -struct RGB8 { - uint8 r; - uint8 g; - uint8 b; -} PACKED_STRUCT; - -#include "common/pack-end.h" // END STRUCT PACKING - class MemoryHeader { public: uint32 id; @@ -127,7 +119,7 @@ public: byte *lock(uint32 handle); int indexOf(const byte *p); void deallocate(const byte *p); - void deallocate(uint16 handle) { assert("TODO"); } + void deallocate(uint16 handle) { warning("TODO: MemoryManager::deallocate(handle)"); } uint32 getSize(const byte *p); void incLocks(const byte *p); }; @@ -148,7 +140,7 @@ public: int numBits; }; -class RlbManager { +class TLib { private: Common::StringArray _resStrings; MemoryManager &_memoryManager; @@ -160,14 +152,29 @@ private: void loadSection(uint32 fileOffset); void loadIndex(); public: - RlbManager(MemoryManager &memManager, const Common::String filename); - ~RlbManager(); + TLib(MemoryManager &memManager, const Common::String &filename); + ~TLib(); + + byte *getResource(uint16 id, bool suppressErrors = false); + byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false); + bool getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries); + byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false); + bool getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors = false); +}; + +class ResourceManager { +private: + Common::Array<TLib *> _libList; +public: + ~ResourceManager(); + + void addLib(const Common::String &libName); byte *getResource(uint16 id, bool suppressErrors = false); byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false); - void getPalette(int paletteNum, RGB8 *palData, uint *startNum, uint *numEntries); - byte *getSubResource(int resNum, int rlbNum, int index, uint *size); - Common::String getMessage(int resNum, int lineNum); + void getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors = false); + byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false); + Common::String getMessage(int resNum, int lineNum, bool suppressErrors = false); }; diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp new file mode 100644 index 0000000000..29438c0347 --- /dev/null +++ b/engines/tsage/ringworld_demo.cpp @@ -0,0 +1,58 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "tsage/ringworld_demo.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace tSage { + +/*-------------------------------------------------------------------------- + * Ringworld Demo scene + * + *--------------------------------------------------------------------------*/ + +void RingworldDemoScene::postInit(SceneObjectList *OwnerList) { + signal(); +} + +void RingworldDemoScene::signal() { + _soundHandler.startSound(4); + _actor1.postInit(); + _actor2.postInit(); + _actor3.postInit(); + _actor4.postInit(); + _actor5.postInit(); + _actor6.postInit(); + + setAction(&_sequenceManager, this, 22, &_actor1, &_actor2, &_actor3, &_actor4, &_actor5, &_actor6, NULL); +} + +void RingworldDemoScene::process(Event &event) { + +} + +} // End of namespace tSage diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h new file mode 100644 index 0000000000..63ffe56555 --- /dev/null +++ b/engines/tsage/ringworld_demo.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef TSAGE_RINGWORLD_DEMO_H +#define TSAGE_RINGWORLD_DEMO_H + +#include "common/scummsys.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" + +namespace tSage { + + +class RingworldDemoScene: public Scene { +public: + SequenceManager _sequenceManager; + SceneObject _actor1, _actor2, _actor3; + SceneObject _actor4, _actor5, _actor6; + SoundHandler _soundHandler; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void process(Event &event); + virtual void signal(); +}; + +} // End of namespace tSage + +#endif diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 32f62bea76..d334e0ce1f 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -23,10 +23,14 @@ * */ +#include "common/config-manager.h" +#include "common/translation.h" +#include "gui/saveload.h" #include "tsage/ringworld_logic.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" +#include "tsage/ringworld_demo.h" #include "tsage/ringworld_scenes1.h" #include "tsage/ringworld_scenes2.h" #include "tsage/ringworld_scenes3.h" @@ -39,6 +43,9 @@ namespace tSage { Scene *SceneFactory::createScene(int sceneNumber) { + if (_vm->getFeatures() & GF_DEMO) + return new RingworldDemoScene(); + switch (sceneNumber) { /* Scene group 1 */ // Kziniti Palace (Introduction) @@ -141,32 +148,47 @@ Scene *SceneFactory::createScene(int sceneNumber) { case 5300: return new Scene5300(); /* Scene group 8 */ - // Scene 7000: Landing + // Landing near beach case 7000: return new Scene7000(); - // Scene 7100: swimming under water + // Underwater: swimming case 7100: return new Scene7100(); - // Scene 7200: Entering the underwater cave + // Underwater: Entering the cave case 7200: return new Scene7200(); - // Scene 7300: Discussion with Lord Poria + // Underwater: Lord Poria case 7300: return new Scene7300(); + // Floating Buildings: Outside case 7600: return new Scene7600(); + // Floating Buildings: In the lab case 7700: return new Scene7700(); /* Scene group 10 */ + // Near beach: Slave washing clothes case 9100: return new Scene9100(); + // Castle: Outside the bulwarks case 9150: return new Scene9150(); + // Castle: Near the fountain case 9200: return new Scene9200(); + // Castle: In front of a large guarded door case 9300: return new Scene9300(); + // Castle: In a hallway case 9350: return new Scene9350(); + // Castle: In a hallway case 9360: return new Scene9360(); + // Castle: Black-Smith room case 9400: return new Scene9400(); + // Castle: Dining room case 9450: return new Scene9450(); + // Castle: Bedroom case 9500: return new Scene9500(); + // Castle: Balcony case 9700: return new Scene9700(); + // Castle: In the garden case 9750: return new Scene9750(); + // Castle: Dressing room case 9850: return new Scene9850(); - // Scene 9900: Ending + // Ending case 9900: return new Scene9900(); + // Space travel case 9999: return new Scene9999(); default: @@ -196,7 +218,7 @@ DisplayHotspot::DisplayHotspot(int regionId, ...) { bool DisplayHotspot::performAction(int action) { for (uint i = 0; i < _actions.size(); i += 3) { if (_actions[i] == action) { - display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); return true; } } @@ -223,7 +245,7 @@ DisplayObject::DisplayObject(int firstAction, ...) { bool DisplayObject::performAction(int action) { for (uint i = 0; i < _actions.size(); i += 3) { if (_actions[i] == action) { - display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); return true; } } @@ -285,7 +307,7 @@ void SceneArea::wait() { g_system->delayMillis(10); } - SynchronisedList<SceneItem *>::iterator ii; + SynchronizedList<SceneItem *>::iterator ii; for (ii = _globals->_sceneItems.begin(); ii != _globals->_sceneItems.end(); ++ii) { SceneItem *sceneItem = *ii; if (sceneItem->contains(event.mousePos)) { @@ -297,14 +319,17 @@ void SceneArea::wait() { _globals->_events.setCursor(CURSOR_ARROW); } -void SceneArea::synchronise(Serialiser &s) { +void SceneArea::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + SavedObject::synchronize(s); + s.syncAsSint16LE(_pt.x); s.syncAsSint16LE(_pt.y); s.syncAsSint32LE(_resNum); s.syncAsSint32LE(_rlbNum); s.syncAsSint32LE(_subNum); s.syncAsSint32LE(_actionId); - _bounds.synchronise(s); + _bounds.synchronize(s); } /*--------------------------------------------------------------------------*/ @@ -313,7 +338,7 @@ SpeakerGText::SpeakerGText() { _speakerName = "GTEXT"; _textWidth = 160; _textPos = Common::Point(130, 10); - _colour1 = 42; + _color1 = 42; _hideObjects = false; } @@ -322,7 +347,7 @@ void SpeakerGText::setText(const Common::String &msg) { _sceneObject.postInit(); _sceneObject.setVisage(9405); _sceneObject.setStrip2(3); - _sceneObject.setPriority2(255); + _sceneObject.fixPriority(255); _sceneObject.changeZoom(100); _sceneObject._frame = 1; _sceneObject.setPosition(Common::Point(183, 71)); @@ -331,7 +356,7 @@ void SpeakerGText::setText(const Common::String &msg) { // Set the text Rect textRect; _globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth); - textRect.centre(_sceneObject._position.x, _sceneObject._position.y); + textRect.center(_sceneObject._position.x, _sceneObject._position.y); _textPos.x = textRect.left; Speaker::setText(msg); } @@ -347,7 +372,7 @@ SpeakerPOR::SpeakerPOR() { _speakerName = "POR"; _newSceneNumber = 7221; _textPos = Common::Point(10, 30); - _colour1 = 41; + _color1 = 41; } void SpeakerPOR::SpeakerAction1::signal(){ @@ -371,19 +396,19 @@ void SpeakerPOR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(7223); _object1.setStrip2(2); - _object1.setPosition(Common::Point(191, 166), 0); - _object1.animate(ANIM_MODE_7, 0, 0); + _object1.setPosition(Common::Point(191, 166)); + _object1.animate(ANIM_MODE_7, 0, NULL); _object2.postInit(&_objectList); _object2.setVisage(7223); - _object2.setPosition(Common::Point(159, 86), 0); - _object2.setAction(&_speakerAction, 0); + _object2.setPosition(Common::Point(159, 86)); + _object2.setAction(&_speakerAction, NULL); _object3.postInit(&_objectList); _object3.setVisage(7223); _object3.setStrip(3); - _object3.setPosition(Common::Point(119, 107), 0); - _object3.setPriority2(199); + _object3.setPosition(Common::Point(119, 107)); + _object3.fixPriority(199); _object3.setAction(&_action2); Speaker::setText(msg); @@ -395,7 +420,7 @@ SpeakerOR::SpeakerOR() { _speakerName = "OR"; _newSceneNumber = 9430; _textPos = Common::Point(8, 36); - _colour1 = 42; + _color1 = 42; _textWidth = 136; } @@ -403,20 +428,20 @@ void SpeakerOR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(9431); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; - _object1.setPosition(Common::Point(202, 147), 0); - _object1.animate(ANIM_MODE_7, 0, 0); + _object1.setPosition(Common::Point(202, 147)); + _object1.animate(ANIM_MODE_7, 0, NULL); _object2.postInit(&_objectList); _object2.setVisage(9431); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.setZoom(100); _object2._frame = 1; - _object2.setPosition(Common::Point(199, 85), 0); - _object2.setAction(&_speakerAction, 0); + _object2.setPosition(Common::Point(199, 85)); + _object2.setAction(&_speakerAction, NULL); Speaker::setText(msg); } @@ -427,7 +452,7 @@ SpeakerOText::SpeakerOText() : SpeakerGText() { _speakerName = "OTEXT"; _textWidth = 240; _textPos = Common::Point(130, 10); - _colour1 = 42; + _color1 = 42; _hideObjects = false; } @@ -436,9 +461,9 @@ SpeakerOText::SpeakerOText() : SpeakerGText() { SpeakerQText::SpeakerQText() : ScreenSpeaker() { _speakerName = "QTEXT"; _textPos = Common::Point(160, 40); - _colour1 = 35; + _color1 = 35; _textWidth = 240; - _textMode = ALIGN_CENTRE; + _textMode = ALIGN_CENTER; _hideObjects = false; } @@ -446,9 +471,9 @@ SpeakerQText::SpeakerQText() : ScreenSpeaker() { SpeakerSText::SpeakerSText() : ScreenSpeaker() { _speakerName = "STEXT"; - _colour1 = 13; + _color1 = 13; _textWidth = 240; - _textMode = ALIGN_CENTRE; + _textMode = ALIGN_CENTER; _hideObjects = false; } @@ -457,8 +482,8 @@ SpeakerSText::SpeakerSText() : ScreenSpeaker() { SpeakerPOText::SpeakerPOText() : ScreenSpeaker() { _speakerName = "POTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 41; + _textMode = ALIGN_CENTER; + _color1 = 41; _hideObjects = false; } @@ -466,9 +491,9 @@ SpeakerPOText::SpeakerPOText() : ScreenSpeaker() { SpeakerMText::SpeakerMText() { _speakerName = "MTEXT"; - _colour1 = 11; - _textWidth = 160; - _textMode = ALIGN_CENTRE; + _color1 = 22; + _textWidth = 230; + _textMode = ALIGN_CENTER; _hideObjects = false; } @@ -476,9 +501,9 @@ SpeakerMText::SpeakerMText() { SpeakerCText::SpeakerCText() { _speakerName = "CTEXT"; - _colour1 = 4; + _color1 = 4; _textWidth = 240; - _textMode = ALIGN_CENTRE; + _textMode = ALIGN_CENTER; _hideObjects = false; } @@ -487,18 +512,31 @@ SpeakerCText::SpeakerCText() { SpeakerEText::SpeakerEText() { _speakerName = "ETEXT"; _textPos = Common::Point(20, 20); - _colour1 = 22; + _color1 = 22; _hideObjects = false; } /*--------------------------------------------------------------------------*/ -SpeakerGR::SpeakerGR() { +SpeakerGR::SpeakerGR() : AnimatedSpeaker() { _speakerName = "GR"; _newSceneNumber = 9220; _textWidth = 136; _textPos = Common::Point(168, 36); - _colour1 = 14; + _color1 = 14; +} + +void SpeakerGR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(9221); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(101, 70)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + Speaker::setText(msg); } /*--------------------------------------------------------------------------*/ @@ -506,7 +544,7 @@ SpeakerGR::SpeakerGR() { SpeakerHText::SpeakerHText() { _speakerName = "HTEXT"; _textPos = Common::Point(160, 40); - _colour1 = 52; + _color1 = 52; _hideObjects = false; } @@ -515,8 +553,8 @@ SpeakerHText::SpeakerHText() { SpeakerSKText::SpeakerSKText() : ScreenSpeaker() { _speakerName = "SKTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 5; + _textMode = ALIGN_CENTER; + _color1 = 9; _hideObjects = false; } @@ -525,8 +563,8 @@ SpeakerSKText::SpeakerSKText() : ScreenSpeaker() { SpeakerPText::SpeakerPText() { _speakerName = "PTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 5; + _textMode = ALIGN_CENTER; + _color1 = 5; _hideObjects = false; } @@ -535,8 +573,8 @@ SpeakerPText::SpeakerPText() { SpeakerCHFText::SpeakerCHFText() { _speakerName = "CHFTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 56; + _textMode = ALIGN_CENTER; + _color1 = 56; _hideObjects = false; } @@ -545,8 +583,8 @@ SpeakerCHFText::SpeakerCHFText() { SpeakerCDRText::SpeakerCDRText() { _speakerName = "CDRTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 52; + _textMode = ALIGN_CENTER; + _color1 = 52; _hideObjects = false; } @@ -555,7 +593,7 @@ SpeakerCDRText::SpeakerCDRText() { SpeakerFLText::SpeakerFLText() { _speakerName = "FLTEXT"; _textPos = Common::Point(10, 40); - _colour1 = 17; + _color1 = 17; _hideObjects = false; } @@ -564,8 +602,8 @@ SpeakerFLText::SpeakerFLText() { SpeakerBatText::SpeakerBatText() { _speakerName = "BATTEXT"; _textWidth = 240; - _textMode = ALIGN_CENTRE; - _colour1 = 3; + _textMode = ALIGN_CENTER; + _color1 = 3; _hideObjects = false; } @@ -575,23 +613,23 @@ SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() { _speakerName = "SKL"; _newSceneNumber = 7011; _textPos = Common::Point(10, 30); - _colour1 = 10; + _color1 = 9; } void SpeakerSKL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(7013); _object1.setStrip2(2); - _object1._frame = 1; - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); + _object1._frame = 1; _object1.setPosition(Common::Point(203, 120)); _object1.animate(ANIM_MODE_7, 0, NULL); _object2.postInit(&_objectList); _object2.setVisage(7013); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(197, 80)); @@ -606,15 +644,15 @@ SpeakerQL::SpeakerQL() : AnimatedSpeaker() { _speakerName = "QL"; _newSceneNumber = 2610; _textPos = Common::Point(160, 30); - _colour1 = 35; - _textMode = ALIGN_CENTRE; + _color1 = 35; + _textMode = ALIGN_CENTER; } void SpeakerQL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2612); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(128, 146)); @@ -623,7 +661,7 @@ void SpeakerQL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2612); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(122, 84)); @@ -635,18 +673,19 @@ void SpeakerQL::setText(const Common::String &msg) { /*--------------------------------------------------------------------------*/ SpeakerSR::SpeakerSR() { + // TODO: check initialization of object3 _speakerName = "SR"; _newSceneNumber = 2811; _textPos = Common::Point(10, 30); - _colour1 = 13; - _textMode = ALIGN_CENTRE; + _color1 = 13; + _textMode = ALIGN_CENTER; } void SpeakerSR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2813); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(224, 198)); @@ -655,7 +694,7 @@ void SpeakerSR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2813); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(203, 96)); @@ -665,7 +704,7 @@ void SpeakerSR::setText(const Common::String &msg) { _object3.setVisage(2813); _object3.setStrip(3); _object3.setPosition(Common::Point(204, 91)); - _object3.setPriority2(199); + _object3.fixPriority(199); _object3._numFrames = 3; _object3.animate(ANIM_MODE_7, 0, NULL); @@ -679,15 +718,15 @@ SpeakerSL::SpeakerSL() { _newSceneNumber = 2810; _textPos = Common::Point(140, 30); _textWidth = 160; - _colour1 = 13; - _textMode = ALIGN_CENTRE; + _color1 = 13; + _textMode = ALIGN_CENTER; } void SpeakerSL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2812); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(95, 198)); @@ -696,7 +735,7 @@ void SpeakerSL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2812); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(116, 96)); @@ -711,15 +750,15 @@ SpeakerQR::SpeakerQR() { _speakerName = "QR"; _newSceneNumber = 2611; _textPos = Common::Point(10, 30); - _colour1 = 13; - _textMode = ALIGN_CENTRE; + _color1 = 35; + _textMode = ALIGN_CENTER; } void SpeakerQR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2613); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(191, 146)); @@ -728,7 +767,7 @@ void SpeakerQR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2613); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(197, 84)); @@ -743,28 +782,28 @@ SpeakerQU::SpeakerQU() { _speakerName = "QU"; _newSceneNumber = 7020; _textPos = Common::Point(160, 30); - _colour1 = 35; - _textMode = ALIGN_CENTRE; + _color1 = 35; + _textMode = ALIGN_CENTER; } void SpeakerQU::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(7021); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; - _object1.setPosition(Common::Point(116, 120), 0); - _object1.animate(ANIM_MODE_7, 0, 0); + _object1.setPosition(Common::Point(116, 120)); + _object1.animate(ANIM_MODE_7, 0, NULL); _object2.postInit(&_objectList); _object2.setVisage(7021); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; - _object2.setPosition(Common::Point(111, 84), 0); - _object2.setAction(&_speakerAction, 0); + _object2.setPosition(Common::Point(111, 84)); + _object2.setAction(&_speakerAction, NULL); Speaker::setText(msg); } @@ -775,21 +814,21 @@ SpeakerCR::SpeakerCR() { _speakerName = "CR"; _newSceneNumber = 9010; _textPos = Common::Point(20, 40); - _colour1 = 4; + _color1 = 4; } void SpeakerCR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(9011); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.setPosition(Common::Point(219, 168)); _object1.animate(ANIM_MODE_7, 0, NULL); _object2.postInit(&_objectList); _object2.setVisage(9011); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.setPosition(Common::Point(232, 81)); _object2.setAction(&_speakerAction, NULL); @@ -801,15 +840,15 @@ void SpeakerCR::setText(const Common::String &msg) { SpeakerMR::SpeakerMR() { _speakerName = "MR"; _newSceneNumber = 2711; - _textPos = Common::Point(40, 10); - _colour1 = 22; + _textPos = Common::Point(10, 40); + _color1 = 22; } void SpeakerMR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2713); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(220, 143)); @@ -818,7 +857,8 @@ void SpeakerMR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2713); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(215, 99)); _object2.setAction(&_speakerAction, NULL); @@ -832,15 +872,15 @@ SpeakerSAL::SpeakerSAL() { _speakerName = "SAL"; _newSceneNumber = 2851; _textPos = Common::Point(10, 30); - _colour1 = 13; - _textMode = ALIGN_CENTRE; + _color1 = 13; + _textMode = ALIGN_CENTER; } void SpeakerSAL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2853); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(185, 200)); @@ -849,7 +889,8 @@ void SpeakerSAL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2853); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(170, 92)); _object2.setAction(&_speakerAction, NULL); @@ -863,14 +904,14 @@ SpeakerML::SpeakerML() { _speakerName = "ML"; _newSceneNumber = 2710; _textPos = Common::Point(160, 40); - _colour1 = 22; + _color1 = 22; } void SpeakerML::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(2712); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(99, 143)); @@ -879,7 +920,8 @@ void SpeakerML::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(2712); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(105, 99)); _object2.setAction(&_speakerAction, NULL); @@ -893,14 +935,14 @@ SpeakerCHFL::SpeakerCHFL() { _speakerName = "CHFL"; _newSceneNumber = 4111; _textPos = Common::Point(10, 40); - _colour1 = 56; + _color1 = 56; } void SpeakerCHFL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4113); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(205, 116)); @@ -909,7 +951,8 @@ void SpeakerCHFL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4113); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(202, 71)); _object2.setAction(&_speakerAction, NULL); @@ -923,14 +966,14 @@ SpeakerCHFR::SpeakerCHFR() { _speakerName = "CHFR"; _newSceneNumber = 4110; _textPos = Common::Point(160, 40); - _colour1 = 56; + _color1 = 56; } void SpeakerCHFR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4112); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(103, 116)); @@ -939,7 +982,8 @@ void SpeakerCHFR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4112); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(106, 71)); _object2.setAction(&_speakerAction, NULL); @@ -953,14 +997,14 @@ SpeakerPL::SpeakerPL() { _speakerName = "PL"; _newSceneNumber = 4060; _textPos = Common::Point(160, 40); - _colour1 = 5; + _color1 = 5; } void SpeakerPL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4062); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(107, 117)); @@ -969,7 +1013,8 @@ void SpeakerPL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4062); _object2.setStrip2(1); - _object2.setPriority2(200); + _object2.fixPriority(200); + _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(105, 62)); _object2.setAction(&_speakerAction, NULL); @@ -977,7 +1022,8 @@ void SpeakerPL::setText(const Common::String &msg) { _object3.postInit(&_objectList); _object3.setVisage(4062); _object3.setStrip2(3); - _object3.setPriority2(255); + _object3.fixPriority(255); + _object3.changeZoom(100); _object3._frame = 1; _object3.setPosition(Common::Point(105, 59)); _object3.setAction(&_speakerAction2, NULL); @@ -996,14 +1042,14 @@ SpeakerPR::SpeakerPR() { _speakerName = "PR"; _newSceneNumber = 4061; _textPos = Common::Point(10, 40); - _colour1 = 5; + _color1 = 5; } void SpeakerPR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4063); _object1.setStrip2(1); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(212, 117)); @@ -1012,7 +1058,7 @@ void SpeakerPR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4063); _object2.setStrip2(2); - _object2.setPriority2(200); + _object2.fixPriority(200); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(214, 62)); @@ -1021,7 +1067,7 @@ void SpeakerPR::setText(const Common::String &msg) { _object3.postInit(&_objectList); _object3.setVisage(4063); _object3.setStrip2(3); - _object3.setPriority2(255); + _object3.fixPriority(255); _object3.changeZoom(100); _object3._frame = 1; _object3.setPosition(Common::Point(214, 59)); @@ -1041,14 +1087,14 @@ SpeakerCDR::SpeakerCDR() { _speakerName = "CDR"; _newSceneNumber = 4161; _textPos = Common::Point(10, 40); - _colour1 = 52; + _color1 = 52; } void SpeakerCDR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4163); _object1.setStrip2(1); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(208, 97)); @@ -1057,7 +1103,7 @@ void SpeakerCDR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4163); _object2.setStrip2(2); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(200, 57)); @@ -1072,14 +1118,14 @@ SpeakerCDL::SpeakerCDL() { _speakerName = "CDL"; _newSceneNumber = 4160; _textPos = Common::Point(160, 40); - _colour1 = 52; + _color1 = 52; } void SpeakerCDL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(4162); _object1.setStrip2(1); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(112, 97)); @@ -1088,7 +1134,7 @@ void SpeakerCDL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(4162); _object2.setStrip2(2); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(115, 57)); @@ -1103,14 +1149,14 @@ SpeakerFLL::SpeakerFLL() { _speakerName = "FLL"; _newSceneNumber = 5221; _textPos = Common::Point(10, 40); - _colour1 = 17; + _color1 = 17; } void SpeakerFLL::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(5223); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(216, 129)); @@ -1119,7 +1165,7 @@ void SpeakerFLL::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(5223); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(210, 67)); @@ -1134,14 +1180,14 @@ SpeakerBatR::SpeakerBatR() { _speakerName = "BATR"; _newSceneNumber = 5360; _textPos = Common::Point(140, 40); - _colour1 = 3; + _color1 = 3; } void SpeakerBatR::setText(const Common::String &msg) { _object1.postInit(&_objectList); _object1.setVisage(5361); _object1.setStrip2(2); - _object1.setPriority2(255); + _object1.fixPriority(255); _object1.changeZoom(100); _object1._frame = 1; _object1.setPosition(Common::Point(137, 122)); @@ -1150,7 +1196,7 @@ void SpeakerBatR::setText(const Common::String &msg) { _object2.postInit(&_objectList); _object2.setVisage(5361); _object2.setStrip2(1); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2.changeZoom(100); _object2._frame = 1; _object2.setPosition(Common::Point(137, 104)); @@ -1159,4 +1205,239 @@ void SpeakerBatR::setText(const Common::String &msg) { Speaker::setText(msg); } +/*--------------------------------------------------------------------------*/ + +RingworldInvObjectList::RingworldInvObjectList() : + _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."), + _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."), + _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."), + _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."), + _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."), + _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."), + _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."), + _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."), + _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."), + _key(7700, 1, 11, OBJECT_KEY, "A key."), + _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."), + _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."), + _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."), + _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."), + _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."), + _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."), + _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."), + _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."), + _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."), + _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."), + _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."), + _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."), + _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."), + _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."), + _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."), + _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."), + _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."), + _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."), + _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."), + _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."), + _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."), + _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."), + _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") { + + // Add the items to the list + _itemList.push_back(&_stunner); + _itemList.push_back(&_scanner); + _itemList.push_back(&_stasisBox); + _itemList.push_back(&_infoDisk); + _itemList.push_back(&_stasisNegator); + _itemList.push_back(&_keyDevice); + _itemList.push_back(&_medkit); + _itemList.push_back(&_ladder); + _itemList.push_back(&_rope); + _itemList.push_back(&_key); + _itemList.push_back(&_translator); + _itemList.push_back(&_ale); + _itemList.push_back(&_paper); + _itemList.push_back(&_waldos); + _itemList.push_back(&_stasisBox2); + _itemList.push_back(&_ring); + _itemList.push_back(&_cloak); + _itemList.push_back(&_tunic); + _itemList.push_back(&_candle); + _itemList.push_back(&_straw); + _itemList.push_back(&_scimitar); + _itemList.push_back(&_sword); + _itemList.push_back(&_helmet); + _itemList.push_back(&_items); + _itemList.push_back(&_concentrator); + _itemList.push_back(&_nullifier); + _itemList.push_back(&_peg); + _itemList.push_back(&_vial); + _itemList.push_back(&_jacket); + _itemList.push_back(&_tunic2); + _itemList.push_back(&_bone); + _itemList.push_back(&_jar); + _itemList.push_back(&_emptyJar); + + _selectedItem = NULL; +} + +/*--------------------------------------------------------------------------*/ + +void RingworldGame::restartGame() { + if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) + _globals->_game->restart(); +} + +void RingworldGame::saveGame() { + if (!_vm->canSaveGameStateCurrently()) + MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the save dialog + handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName); + } +} + +void RingworldGame::restoreGame() { + if (!_vm->canLoadGameStateCurrently()) + MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the load dialog + handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); + } +} + +void RingworldGame::quitGame() { + if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) + _vm->quitGame(); +} + +void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { + const EnginePlugin *plugin = 0; + EngineMan.findGame(_vm->getGameId(), &plugin); + GUI::SaveLoadChooser *dialog; + if (saveFlag) + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); + else + dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); + + dialog->setSaveMode(saveFlag); + + saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + saveName = dialog->getResultString(); + + delete dialog; +} + +void RingworldGame::start() { + // Set some default flags and cursor + _globals->setFlag(12); + _globals->setFlag(34); + _globals->_events.setCursor(CURSOR_WALK); + + // Set the screen to scroll in response to the player moving off-screen + _globals->_scrollFollower = &_globals->_player; + + // Set the object's that will be in the player's inventory by default + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; + RING_INVENTORY._ring._sceneNumber = 1; + + // Switch to the title screen + _globals->_sceneManager.setNewScene(1000); + + _globals->_events.showCursor(); +} + +void RingworldGame::restart() { + _globals->_scenePalette.clearListeners(); + _globals->_soundHandler.proc3(); + + // Reset the flags + _globals->reset(); + _globals->setFlag(34); + + // Clear save/load slots + _globals->_sceneHandler._saveGameSlot = -1; + _globals->_sceneHandler._loadGameSlot = -1; + + _globals->_stripNum = 0; + _globals->_events.setCursor(CURSOR_WALK); + + // Reset item properties + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 5200; + RING_INVENTORY._infoDisk._sceneNumber = 40; + RING_INVENTORY._stasisNegator._sceneNumber = 0; + RING_INVENTORY._keyDevice._sceneNumber = 0; + RING_INVENTORY._medkit._sceneNumber = 2280; + RING_INVENTORY._ladder._sceneNumber = 4100; + RING_INVENTORY._rope._sceneNumber = 4150; + RING_INVENTORY._key._sceneNumber = 7700; + RING_INVENTORY._translator._sceneNumber = 2150; + RING_INVENTORY._paper._sceneNumber = 7700; + RING_INVENTORY._waldos._sceneNumber = 0; + RING_INVENTORY._ring._sceneNumber = 1; + RING_INVENTORY._stasisBox2._sceneNumber = 8100; + RING_INVENTORY._cloak._sceneNumber = 9850; + RING_INVENTORY._tunic._sceneNumber = 9450; + RING_INVENTORY._candle._sceneNumber = 9500; + RING_INVENTORY._straw._sceneNumber = 9400; + RING_INVENTORY._scimitar._sceneNumber = 9850; + RING_INVENTORY._sword._sceneNumber = 9850; + RING_INVENTORY._helmet._sceneNumber = 9500; + RING_INVENTORY._items._sceneNumber = 4300; + RING_INVENTORY._concentrator._sceneNumber = 4300; + RING_INVENTORY._nullifier._sceneNumber = 4300; + RING_INVENTORY._peg._sceneNumber = 4045; + RING_INVENTORY._vial._sceneNumber = 5100; + RING_INVENTORY._jacket._sceneNumber = 9850; + RING_INVENTORY._tunic2._sceneNumber = 9850; + RING_INVENTORY._bone._sceneNumber = 5300; + RING_INVENTORY._jar._sceneNumber = 7700; + RING_INVENTORY._emptyJar._sceneNumber = 7700; + RING_INVENTORY._selectedItem = NULL; + + // Change to the first game scene + _globals->_sceneManager.changeScene(30); +} + +void RingworldGame::endGame(int resNum, int lineNum) { + _globals->_events.setCursor(CURSOR_WALK); + Common::String msg = _resourceManager->getMessage(resNum, lineNum); + bool savesExist = _saver->savegamesExist(); + + if (!savesExist) { + // No savegames exist, so prompt the user to restart or quit + if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0) + _vm->quitGame(); + else + restart(); + } else { + // Savegames exist, so prompt for Restore/Restart + bool breakFlag; + do { + if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) { + breakFlag = true; + } else { + handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName); + breakFlag = _globals->_sceneHandler._loadGameSlot > 0; + } + } while (!breakFlag); + } + + _globals->_events.setCursorFromFlag(); +} + +/*--------------------------------------------------------------------------*/ + +void RingworldDemoGame::start() { + // Start the demo's single scene + _globals->_sceneManager.changeScene(1); + + _globals->_events.setCursor(CURSOR_NONE); +} + +void RingworldDemoGame::restart() { +} + } // End of namespace tSage diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h index 66c7bff912..e84779e6ad 100644 --- a/engines/tsage/ringworld_logic.h +++ b/engines/tsage/ringworld_logic.h @@ -97,7 +97,7 @@ public: void display(); void restore(); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void draw(bool flag); virtual void wait(); }; @@ -192,6 +192,7 @@ public: SpeakerGR(); virtual Common::String getClassName() { return "SpeakerGR"; } + virtual void setText(const Common::String &msg); }; class SpeakerHText : public ScreenSpeaker { @@ -397,6 +398,77 @@ public: virtual void setText(const Common::String &msg); }; +/*--------------------------------------------------------------------------*/ + +class RingworldInvObjectList : public InvObjectList { +public: + InvObject _stunner; + InvObject _scanner; + InvObject _stasisBox; + InvObject _infoDisk; + InvObject _stasisNegator; + InvObject _keyDevice; + InvObject _medkit; + InvObject _ladder; + InvObject _rope; + InvObject _key; + InvObject _translator; + InvObject _ale; + InvObject _paper; + InvObject _waldos; + InvObject _stasisBox2; + InvObject _ring; + InvObject _cloak; + InvObject _tunic; + InvObject _candle; + InvObject _straw; + InvObject _scimitar; + InvObject _sword; + InvObject _helmet; + InvObject _items; + InvObject _concentrator; + InvObject _nullifier; + InvObject _peg; + InvObject _vial; + InvObject _jacket; + InvObject _tunic2; + InvObject _bone; + InvObject _jar; + InvObject _emptyJar; +public: + RingworldInvObjectList(); + + virtual Common::String getClassName() { return "RingworldInvObjectList"; } +}; + +#define RING_INVENTORY (*((RingworldInvObjectList *)_globals->_inventory)) + +class RingworldGame: public Game { +protected: + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); +public: + virtual void start(); + virtual void restart(); + virtual void restartGame(); + virtual void saveGame(); + virtual void restoreGame(); + virtual void quitGame(); + virtual void endGame(int resNum, int lineNum); +}; + +class RingworldDemoGame: public Game { +protected: + virtual void restart(); +public: + virtual void start(); + virtual void restartGame() {} + virtual void saveGame() {} + virtual void restoreGame() {} + virtual void quitGame() {} + virtual void endGame(int resNum, int lineNum) {} +}; + + } // End of namespace tSage #endif diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp index 4497d6af75..e5ec60c690 100644 --- a/engines/tsage/ringworld_scenes1.cpp +++ b/engines/tsage/ringworld_scenes1.cpp @@ -48,7 +48,7 @@ void Scene10::Action1::signal() { break; case 2: scene->_speakerSText.setTextPos(Common::Point(20, 20)); - scene->_speakerSText._colour1 = 10; + scene->_speakerSText._color1 = 10; scene->_speakerSText._textWidth = 160; scene->_stripManager.start(11, this, scene); break; @@ -138,10 +138,10 @@ void Scene10::postInit(SceneObjectList *OwnerList) { _speakerSText._hideObjects = false; _speakerQText._hideObjects = false; _speakerQText.setTextPos(Common::Point(140, 120)); - _speakerQText._colour1 = 4; + _speakerQText._color1 = 4; _speakerQText._textWidth = 160; _speakerSText.setTextPos(Common::Point(20, 20)); - _speakerSText._colour1 = 7; + _speakerSText._color1 = 7; _speakerSText._textWidth = 320; _stripManager.setCallback(this); @@ -149,20 +149,20 @@ void Scene10::postInit(SceneObjectList *OwnerList) { _object1.postInit(); _object1.setVisage(10); _object1.setPosition(Common::Point(232, 90)); - _object1.setPriority2(1); + _object1.fixPriority(1); _object2.postInit(); _object2.setVisage(10); _object2.setStrip(4); _object2.setFrame(1); _object2.setPosition(Common::Point(204, 59)); - _object2.setPriority2(198); + _object2.fixPriority(198); _object3.postInit(); _object3.setVisage(10); _object3.setStrip2(5); _object3.setPosition(Common::Point(180, 87)); - _object3.setPriority2(196); + _object3.fixPriority(196); _object3.setAction(&_action2); _object4.postInit(); @@ -221,12 +221,12 @@ void Scene15::Action1::signal() { setDelay(60); break; case 1: - SceneItem::display(15, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 7, + SceneItem::display(15, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 7, SET_WIDTH, 320, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(300); break; case 2: { - SceneItem::display(15, 1, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 7, + SceneItem::display(15, 1, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 7, SET_WIDTH, 320, SET_KEEP_ONSCREEN, 1, LIST_END); scene->_object1.postInit(); scene->_object1.setVisage(15); @@ -300,7 +300,7 @@ void Scene20::Action2::signal() { break; case 1: SceneItem::display(20, 1, SET_WIDTH, 200, SET_Y, 20, SET_X, 160, SET_KEEP_ONSCREEN, true, - SET_EXT_BGCOLOUR, 4, LIST_END); + SET_EXT_BGCOLOR, 4, LIST_END); setDelay(120); break; case 2: { @@ -512,7 +512,7 @@ void Scene20::Action4::signal() { scene->_sound.startSound(77, this, 127); break; case 8: - _globals->_game.endGame(20, 0); + _globals->_game->endGame(20, 0); break; default: break; @@ -533,6 +533,7 @@ void Scene20::postInit(SceneObjectList *OwnerList) { _speakerQText._npc = &_globals->_player; if (_globals->_sceneManager._previousScene == 30) { + // Cut scene: Assassins are coming _globals->_player.postInit(); _globals->_player.setVisage(20); _globals->_player.setPosition(Common::Point(405, 69)); @@ -558,29 +559,13 @@ void Scene20::postInit(SceneObjectList *OwnerList) { _sceneBounds = Rect(320, 0, 640, 200); } else if (_globals->_sceneManager._previousScene == 60) { - _globals->_player.postInit(); - _globals->_player.setVisage(2640); - _globals->_player.animate(ANIM_MODE_NONE, NULL); - _globals->_player.setStrip2(1); - _globals->_player.setFrame2(4); - _globals->_player.setPriority2(200); - _globals->_player.setPosition(Common::Point(425, 233)); - - setAction(&_action1); - _speakerQText.setTextPos(Common::Point(350, 20)); - _speakerQText._textWidth = 260; - _speakerGameText.setTextPos(Common::Point(350, 20)); - _speakerGameText._textWidth = 260; - - _globals->_soundHandler.startSound(8); - _sceneBounds = Rect(320, 0, 640, 200); - } else { + // Evasion _sound.startSound(30); _globals->_player.postInit(); _globals->_player.setVisage(20); _globals->_player.setPosition(Common::Point(588, 79)); _globals->_player._moveDiff = Common::Point(5, 5); - _globals->_player.setPriority2(50); + _globals->_player.fixPriority(50); _globals->_player.animate(ANIM_MODE_1, NULL); _SceneObjectExt.postInit(); @@ -590,22 +575,41 @@ void Scene20::postInit(SceneObjectList *OwnerList) { _sceneObject3.postInit(); _sceneObject3.setVisage(20); - _sceneObject3.setStrip(2); - _SceneObjectExt.setPosition(Common::Point(595, 79)); - _SceneObjectExt.animate(ANIM_MODE_1, NULL); + _sceneObject3.setStrip2(2); + _sceneObject3.setPosition(Common::Point(595, 79)); + _sceneObject3.animate(ANIM_MODE_1, NULL); if ((_globals->getFlag(120) && _globals->getFlag(116)) || (_globals->getFlag(117) && _globals->getFlag(119))) { + // Successful evasion setAction(&_action3); } else if (_globals->getFlag(104)) { _sceneMode = 21; setAction(&_sequenceManager, this, 21, &_globals->_player, &_SceneObjectExt, NULL); } else { + // Failed evasion _sceneObject3._moveDiff = Common::Point(8, 8); setAction(&_action4); } + _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y); + } else { + // Intro: Quinn looking at the monaster + _globals->_player.postInit(); + _globals->_player.setVisage(2640); + _globals->_player.animate(ANIM_MODE_NONE, NULL); + _globals->_player.setStrip2(1); + _globals->_player.setFrame2(4); + _globals->_player.fixPriority(200); + _globals->_player.setPosition(Common::Point(425, 233)); - _sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y); + setAction(&_action1); + _speakerQText.setTextPos(Common::Point(350, 20)); + _speakerQText._textWidth = 260; + _speakerGameText.setTextPos(Common::Point(350, 20)); + _speakerGameText._textWidth = 260; + + _globals->_soundHandler.startSound(8); + _sceneBounds = Rect(320, 0, 640, 200); } _globals->_player.disableControl(); @@ -622,6 +626,29 @@ void Scene20::signal() { * *--------------------------------------------------------------------------*/ +void Scene30::BeamObject::doAction(int action) { + if (action == OBJECT_SCANNER) + display2(30, 14); + else if (action == CURSOR_LOOK) + display2(30, 2); + else if (action == CURSOR_USE) { + Scene30 *parent = (Scene30 *)_globals->_sceneManager._scene; + parent->setAction(&parent->_beamAction); + } else + SceneObject::doAction(action); +} + +void Scene30::DoorObject::doAction(int action) { + if (action == OBJECT_SCANNER) + display2(30, 13); + else if (action == CURSOR_LOOK) + display2(30, 1); + else if (action == CURSOR_USE) + display2(30, 7); + else + SceneObject::doAction(action); +} + void Scene30::BeamAction::signal() { Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene; @@ -817,7 +844,7 @@ void Scene30::KzinObject::doAction(int action) { display2(30, 11); break; case OBJECT_RING: - _globals->_inventory._ring._sceneNumber = 30; + RING_INVENTORY._ring._sceneNumber = 30; scene->setAction(&scene->_ringAction); break; case CURSOR_LOOK: @@ -874,7 +901,7 @@ void Scene30::postInit(SceneObjectList *OwnerList) { _beam.setVisage(31); _beam.setStrip(2); _beam.setPosition(Common::Point(124, 178)); - _beam.setPriority2(188); + _beam.fixPriority(188); // Set up door object _door.postInit(); @@ -900,7 +927,7 @@ void Scene30::signal() { _beam.setVisage(31); _beam.setStrip(2); _beam.setPosition(Common::Point(124, 178)); - _beam.setPriority2(188); + _beam.fixPriority(188); _globals->_sceneItems.push_front(&_beam); _globals->_player.enableControl(); } else if (_sceneMode == 32) { @@ -977,7 +1004,8 @@ void Scene40::Action1::signal() { break; case 9: { scene->_dyingKzin.setStrip(1); - scene->_dyingKzin.setFrame(1); + //Workaround: The original uses setFrame(1) but it's completely wrong. + scene->_dyingKzin.setFrame(2); scene->_dyingKzin._moveDiff.y = 15; scene->_dyingKzin.animate(ANIM_MODE_5, NULL); Common::Point pt(223, 186); @@ -1035,7 +1063,7 @@ void Scene40::Action1::signal() { _globals->_soundHandler.startSound(77, this); break; case 17: - _globals->_game.endGame(40, 20); + _globals->_game->endGame(40, 20); remove(); break; } @@ -1062,10 +1090,10 @@ void Scene40::Action2::signal() { scene->_doorway.postInit(); scene->_doorway.setVisage(16); scene->_doorway.setStrip2(6); - scene->_doorway.setPriority2(200); + scene->_doorway.fixPriority(200); scene->_doorway.setPosition(Common::Point(159, 191)); scene->_doorway._moveDiff = Common::Point(40, 40); - scene->_doorway._field7A = 60; + scene->_doorway._moveRate = 60; scene->_doorway.animate(ANIM_MODE_5, NULL); Common::Point pt(271, 165); @@ -1079,7 +1107,7 @@ void Scene40::Action2::signal() { scene->_assassin._frame = 1; scene->_assassin.animate(ANIM_MODE_5, this); scene->_soundHandler.startSound(29); - _globals->_inventory._infoDisk._sceneNumber = 40; + RING_INVENTORY._infoDisk._sceneNumber = 40; break; case 4: _globals->_player.animate(ANIM_MODE_6, this); @@ -1146,7 +1174,7 @@ void Scene40::Action3::signal() { case 2: scene->_assassin.setStrip(2); scene->_assassin.setFrame(1); - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _globals->_player.animate(ANIM_MODE_6, this); break; case 3: @@ -1180,7 +1208,7 @@ void Scene40::Action5::signal() { switch (_actionIndex++) { case 0: - setDelay(_globals->_randomSource.getRandomNumber(120)); + setDelay(_globals->_randomSource.getRandomNumber(119) + 120); break; case 1: scene->_object2.animate(ANIM_MODE_8, 1, this); @@ -1196,12 +1224,13 @@ void Scene40::Action6::signal() { scene->_object1.postInit(); scene->_object1.setVisage(16); scene->_object1.setStrip2(6); + scene->_object1._moveDiff = Common::Point(40, 40); scene->_object1.setPosition(Common::Point(313, 53)); - scene->_object1._field7A = 60; + scene->_object1._moveRate = 60; Common::Point pt(141, 194); NpcMover *mover = new NpcMover(); - scene->_object1.addMover(mover, &pt, this); + scene->_object1.addMover(mover, &pt, NULL); scene->_object1.animate(ANIM_MODE_5, NULL); scene->_doorway.postInit(); @@ -1229,6 +1258,7 @@ void Scene40::Action7::signal() { switch (_actionIndex++) { case 0: + // TODO: check if it's rand(500) or rand(499)+500 setDelay(_globals->_randomSource.getRandomNumber(500)); break; case 1: @@ -1242,6 +1272,8 @@ void Scene40::Action7::signal() { scene->_object7.setPosition(Common::Point(305, 61)); scene->_object7.setFrame(15); } + scene->_object7.animate(ANIM_MODE_5, this); + scene->_soundHandler.startSound(25); break; case 2: scene->_object7.remove(); @@ -1268,11 +1300,11 @@ void Scene40::Action8::signal() { scene->_doorway.postInit(); scene->_doorway.setVisage(16); scene->_doorway.setStrip2(6); - scene->_doorway.setPriority2(200); - scene->_doorway._field7A = 60; + scene->_doorway.fixPriority(200); + scene->_doorway._moveRate = 60; if (_globals->_player._position.x >= 145) { - scene->_doorway.setPriority2(-1); + scene->_doorway.fixPriority(-1); scene->_doorway.setPosition(Common::Point(6, 157)); } else { scene->_doorway.setPosition(Common::Point(313, 53)); @@ -1296,7 +1328,7 @@ void Scene40::Action8::signal() { _globals->_soundHandler.startSound(77, this); break; case 4: - _globals->_game.endGame(40, 45); + _globals->_game->endGame(40, 45); remove(); break; } @@ -1307,11 +1339,11 @@ void Scene40::Action8::signal() { void Scene40::DyingKzin::doAction(int action) { switch (action) { case OBJECT_STUNNER: - SceneItem::display2(40, 43); - break; - case CURSOR_CROSSHAIRS: SceneItem::display2(40, 44); break; + case OBJECT_SCANNER: + SceneItem::display2(40, 43); + break; case CURSOR_LOOK: SceneItem::display2(40, 12); break; @@ -1328,7 +1360,7 @@ void Scene40::Assassin::doAction(int action) { Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene; switch (action) { - case CURSOR_CROSSHAIRS: + case OBJECT_STUNNER: if (scene->_assassin._visage == 44) SceneItem::display2(40, 21); else { @@ -1336,6 +1368,7 @@ void Scene40::Assassin::doAction(int action) { Common::Point pt(230, 187); NpcMover *mover = new NpcMover(); addMover(mover, &pt, NULL); + scene->setAction(&scene->_action2); } break; case OBJECT_SCANNER: @@ -1345,12 +1378,12 @@ void Scene40::Assassin::doAction(int action) { if (scene->_assassin._visage != 44) SceneItem::display2(40, 13); else - SceneItem::display2(40, (_globals->_inventory._infoDisk._sceneNumber == 1) ? 19 : 14); + SceneItem::display2(40, (RING_INVENTORY._infoDisk._sceneNumber == 1) ? 19 : 14); break; case CURSOR_USE: if (scene->_assassin._visage != 44) SceneItem::display2(40, 15); - else if (_globals->_inventory._infoDisk._sceneNumber == 1) + else if (RING_INVENTORY._infoDisk._sceneNumber == 1) SceneItem::display2(40, 19); else { _globals->_player.disableControl(); @@ -1370,7 +1403,7 @@ void Scene40::Assassin::doAction(int action) { void Scene40::Item2::doAction(int action) { switch (action) { - case CURSOR_CROSSHAIRS: + case OBJECT_STUNNER: SceneItem::display2(40, 35); _globals->_events.setCursor(CURSOR_WALK); break; @@ -1394,7 +1427,7 @@ void Scene40::Item2::doAction(int action) { void Scene40::Item6::doAction(int action) { switch (action) { - case CURSOR_CROSSHAIRS: + case OBJECT_STUNNER: SceneItem::display2(40, 25); _globals->_events.setCursor(CURSOR_WALK); break; @@ -1416,12 +1449,12 @@ void Scene40::Item6::doAction(int action) { /*--------------------------------------------------------------------------*/ Scene40::Scene40() : - _item1(2, OBJECT_SCANNER, 40, 24, CURSOR_CROSSHAIRS, 40, 25, CURSOR_LOOK, 40, 7, CURSOR_USE, 40, 16, LIST_END), - _item3(5, OBJECT_SCANNER, 40, 26, CURSOR_CROSSHAIRS, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END), - _item4(6, OBJECT_SCANNER, 40, 31, CURSOR_CROSSHAIRS, 40, 32, CURSOR_LOOK, 40, 5, CURSOR_USE, 40, 33, LIST_END), + _item1(2, OBJECT_SCANNER, 40, 24, OBJECT_STUNNER, 40, 25, CURSOR_LOOK, 40, 7, CURSOR_USE, 40, 16, LIST_END), + _item3(5, OBJECT_SCANNER, 40, 26, OBJECT_STUNNER, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END), + _item4(6, OBJECT_SCANNER, 40, 31, OBJECT_STUNNER, 40, 32, CURSOR_LOOK, 40, 5, CURSOR_USE, 40, 33, LIST_END), _item5(0, CURSOR_LOOK, 40, 11, LIST_END), - _item7(4, OBJECT_SCANNER, 40, 26, CURSOR_CROSSHAIRS, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END), - _item8(8, OBJECT_SCANNER, 40, 39, CURSOR_CROSSHAIRS, 40, 40, CURSOR_LOOK, 40, 3, CURSOR_USE, 40, 41, LIST_END) { + _item7(4, OBJECT_SCANNER, 40, 26, OBJECT_STUNNER, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END), + _item8(8, OBJECT_SCANNER, 40, 39, OBJECT_STUNNER, 40, 40, CURSOR_LOOK, 40, 3, CURSOR_USE, 40, 41, LIST_END) { } void Scene40::postInit(SceneObjectList *OwnerList) { @@ -1437,7 +1470,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerSText); _stripManager.addSpeaker(&_speakerGameText); - _speakerGameText._colour1 = 9; + _speakerGameText._color1 = 9; _speakerGameText.setTextPos(Common::Point(160, 30)); _speakerQText._npc = &_globals->_player; _speakerSText._npc = &_object1; @@ -1459,14 +1492,14 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _object2.setVisage(41); _object2.setStrip(6); - _object2.setPriority2(200); + _object2.fixPriority(200); _object2.setPosition(Common::Point(94, 189)); _object2.setAction(&_action5); _object3.postInit(); _object3.setVisage(41); _object3.setStrip(5); - _object3.setPriority2(205); + _object3.fixPriority(205); _object3.setPosition(Common::Point(110, 186)); _object3._numFrames = 2; _object3.animate(ANIM_MODE_8, NULL, NULL); @@ -1479,7 +1512,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _dyingKzin.setVisage(40); _dyingKzin.setStrip(6); _dyingKzin.setPosition(Common::Point(-90, 65)); - _dyingKzin.setPriority2(170); + _dyingKzin.fixPriority(170); setAction(&_action1); } else { @@ -1492,7 +1525,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _dyingKzin.postInit(); _dyingKzin.setVisage(40); _dyingKzin.setPosition(Common::Point(205, 183)); - _dyingKzin.setPriority2(170); + _dyingKzin.fixPriority(170); _dyingKzin._frame = 9; _dyingKzin.setAction(&_action7); @@ -1501,7 +1534,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) { _assassin.setPosition(Common::Point(230, 187)); _assassin.setAction(&_action8); - if (_globals->_inventory._infoDisk._sceneNumber == 40) { + if (RING_INVENTORY._infoDisk._sceneNumber == 40) { _assassin.setStrip(1); _assassin.setFrame(_assassin.getFrameCount()); } else { @@ -1759,19 +1792,19 @@ void Scene50::postInit(SceneObjectList *OwnerList) { _object2.setVisage(2331); _object2.setStrip(6); _object2.setPosition(Common::Point(136, 192)); - _object2.setPriority2(200); + _object2.fixPriority(200); _object3.postInit(); _object3.setVisage(2337); _object3.setStrip(6); _object3.setPosition(Common::Point(260, 180)); - _object3.setPriority2(200); + _object3.fixPriority(200); _object4.postInit(); _object4.setVisage(2331); _object4.setStrip(6); _object4.setPosition(Common::Point(295, 144)); - _object4.setPriority2(178); + _object4.fixPriority(178); _globals->_sceneItems.addItems(&_object2, &_object3, &_object4, NULL); @@ -1833,33 +1866,33 @@ void Scene60::Action1::signal() { setDelay(3); break; case 1: - scene->_object9.postInit(); - scene->_object9.setVisage(60); - scene->_object9.setStrip(7); - scene->_object9.setPosition(Common::Point(136, 65)); - scene->_object9.animate(ANIM_MODE_5, this); + scene->_floppyDrive.postInit(); + scene->_floppyDrive.setVisage(60); + scene->_floppyDrive.setStrip(7); + scene->_floppyDrive.setPosition(Common::Point(136, 65)); + scene->_floppyDrive.animate(ANIM_MODE_5, this); scene->_soundHandler1.startSound(35); break; case 2: - scene->_object10.postInit(); - scene->_object10.setVisage(60); - scene->_object10.setPosition(Common::Point(199, 186)); - scene->_object10.animate(ANIM_MODE_8, 0, NULL); - scene->_object10._numFrames = 5; + scene->_redLights.postInit(); + scene->_redLights.setVisage(60); + scene->_redLights.setPosition(Common::Point(199, 186)); + scene->_redLights.animate(ANIM_MODE_8, 0, NULL); + scene->_redLights._numFrames = 5; - scene->_object6.animate(ANIM_MODE_2, NULL); + scene->_controlButton.animate(ANIM_MODE_2, NULL); if (!_globals->getFlag(83)) { - scene->_object5.postInit(); - scene->_object5.setVisage(60); - scene->_object5.setStrip2(3); - scene->_object5.setFrame(2); - scene->_object5.setPosition(Common::Point(148, 85)); - scene->_object5.animate(ANIM_MODE_2, NULL); - scene->_object5._numFrames = 5; - - _globals->_sceneItems.push_front(&scene->_object5); + scene->_message.postInit(); + scene->_message.setVisage(60); + scene->_message.setStrip2(3); + scene->_message.setFrame(2); + scene->_message.setPosition(Common::Point(148, 85)); + scene->_message.animate(ANIM_MODE_2, NULL); + scene->_message._numFrames = 5; + + _globals->_sceneItems.push_front(&scene->_message); scene->_soundHandler2.startSound(38); } @@ -1868,40 +1901,40 @@ void Scene60::Action1::signal() { case 3: scene->_soundHandler2.startSound(37); scene->loadScene(65); - scene->_object5.remove(); + scene->_message.remove(); - if (_globals->_sceneObjects->contains(&scene->_object10)) - scene->_object10.remove(); + if (_globals->_sceneObjects->contains(&scene->_redLights)) + scene->_redLights.remove(); - scene->_object6.remove(); + scene->_controlButton.remove(); scene->_slaveButton.remove(); - scene->_object8.remove(); + scene->_masterButton.remove(); scene->_item1.remove(); scene->_item2.remove(); - scene->_object3.postInit(); - scene->_object3.setVisage(65); - scene->_object3.setPosition(Common::Point(118, 197)); - - scene->_object2.postInit(); - scene->_object2.setVisage(65); - scene->_object2.setStrip(2); - scene->_object2.setPosition(Common::Point(160, 197)); - - scene->_object4.postInit(); - scene->_object4.setVisage(65); - scene->_object4.setStrip(3); - scene->_object4.setPosition(Common::Point(202, 197)); - - scene->_object1.postInit(); - scene->_object1.setVisage(65); - scene->_object1.setStrip(4); - scene->_object1.setFrame(1); - scene->_object1.setPosition(Common::Point(145, 165)); - - _globals->_sceneItems.push_front(&scene->_object3); - _globals->_sceneItems.push_front(&scene->_object2); - _globals->_sceneItems.push_front(&scene->_object4); + scene->_nextButton.postInit(); + scene->_nextButton.setVisage(65); + scene->_nextButton.setPosition(Common::Point(118, 197)); + + scene->_prevButton.postInit(); + scene->_prevButton.setVisage(65); + scene->_prevButton.setStrip(2); + scene->_prevButton.setPosition(Common::Point(160, 197)); + + scene->_exitButton.postInit(); + scene->_exitButton.setVisage(65); + scene->_exitButton.setStrip(3); + scene->_exitButton.setPosition(Common::Point(202, 197)); + + scene->_rose.postInit(); + scene->_rose.setVisage(65); + scene->_rose.setStrip(4); + scene->_rose.setFrame(1); + scene->_rose.setPosition(Common::Point(145, 165)); + + _globals->_sceneItems.push_front(&scene->_nextButton); + _globals->_sceneItems.push_front(&scene->_prevButton); + _globals->_sceneItems.push_front(&scene->_exitButton); setDelay(10); _globals->_events.setCursor(CURSOR_USE); @@ -1913,33 +1946,33 @@ void Scene60::Action1::signal() { case 6: case 7: SceneItem::display(60, _actionIndex - 4, SET_Y, 40, SET_X, 25, SET_FONT, 75, - SET_EXT_BGCOLOUR, -1, SET_FG_COLOUR, 34, SET_POS_MODE, 0, + SET_EXT_BGCOLOR, -1, SET_FG_COLOR, 34, SET_POS_MODE, 0, SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END); _globals->_events.setCursor(CURSOR_USE); break; case 9: _globals->_player._uiEnabled = false; - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; - if (_globals->_sceneObjects->contains(&scene->_object5)) - scene->_object5.remove(); + if (_globals->_sceneObjects->contains(&scene->_message)) + scene->_message.remove(); - scene->_object6.animate(ANIM_MODE_NONE); - scene->_object6.setFrame(1); - scene->_object10.remove(); + scene->_controlButton.animate(ANIM_MODE_NONE); + scene->_controlButton.setFrame(1); + scene->_redLights.remove(); - scene->_object9.postInit(); - scene->_object9.setVisage(60); - scene->_object9.setStrip(7); - scene->_object9.setPosition(Common::Point(136, 65)); - scene->_object9.setFrame(scene->_object9.getFrameCount()); - scene->_object9.animate(ANIM_MODE_6, this); + scene->_floppyDrive.postInit(); + scene->_floppyDrive.setVisage(60); + scene->_floppyDrive.setStrip(7); + scene->_floppyDrive.setPosition(Common::Point(136, 65)); + scene->_floppyDrive.setFrame(scene->_floppyDrive.getFrameCount()); + scene->_floppyDrive.animate(ANIM_MODE_6, this); scene->_soundHandler1.startSound(35); scene->_soundHandler3.proc3(); - scene->_object8.setFrame(1); - scene->_object8._state = 0; + scene->_masterButton.setFrame(1); + scene->_masterButton._state = 0; _globals->clearFlag(103); _globals->clearFlag(!_globals->_stripNum ? 116 : 119); @@ -1949,9 +1982,10 @@ void Scene60::Action1::signal() { break; case 11: _globals->_player._uiEnabled = true; - scene->_object9.remove(); + scene->_floppyDrive.remove(); remove(); break; + case 8: default: break; } @@ -1976,7 +2010,7 @@ void Scene60::Action2::signal() { /*--------------------------------------------------------------------------*/ -void Scene60::Object2::doAction(int action) { +void Scene60::PrevObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -1994,7 +2028,7 @@ void Scene60::Object2::doAction(int action) { } } -void Scene60::Object3::doAction(int action) { +void Scene60::NextObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -2011,7 +2045,7 @@ void Scene60::Object3::doAction(int action) { } } -void Scene60::Object4::doAction(int action) { +void Scene60::ExitObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -2019,47 +2053,49 @@ void Scene60::Object4::doAction(int action) { } else if (action == CURSOR_USE) { scene->_soundHandler3.startSound(36); animate(ANIM_MODE_8, 1, NULL); - scene->_object3.remove(); - scene->_object2.remove(); - scene->_object4.remove(); - scene->_object1.remove(); + scene->_nextButton.remove(); + scene->_prevButton.remove(); + scene->_exitButton.remove(); + scene->_rose.remove(); SceneItem::display(0, 0); scene->loadScene(60); - scene->_object6.setVisage(60); - scene->_object6.setPosition(Common::Point(233, 143)); - scene->_object6.animate(ANIM_MODE_2, NULL); + scene->_controlButton.postInit(); + scene->_controlButton.setVisage(60); + scene->_controlButton.setStrip(5); + scene->_controlButton.setPosition(Common::Point(233, 143)); + scene->_controlButton.animate(ANIM_MODE_2, NULL); scene->_slaveButton.postInit(); scene->_slaveButton.setVisage(60); scene->_slaveButton.setStrip(8); scene->_slaveButton.setPosition(Common::Point(143, 125)); - scene->_object8.postInit(); - scene->_object8.setVisage(60); - scene->_object8.setStrip(8); - scene->_object8.setPosition(Common::Point(143, 105)); + scene->_masterButton.postInit(); + scene->_masterButton.setVisage(60); + scene->_masterButton.setStrip(8); + scene->_masterButton.setPosition(Common::Point(143, 105)); - _globals->_sceneItems.push_front(&scene->_object8); + _globals->_sceneItems.push_front(&scene->_masterButton); _globals->_sceneItems.push_front(&scene->_slaveButton); - scene->_object10.postInit(); - scene->_object10.setVisage(60); - scene->_object10.setPosition(Common::Point(199, 186)); - scene->_object10.animate(ANIM_MODE_8, 0, NULL); - scene->_object10._numFrames = 5; - scene->_object10.setAction(&scene->_sequenceManager, scene, 61, NULL); + scene->_redLights.postInit(); + scene->_redLights.setVisage(60); + scene->_redLights.setPosition(Common::Point(199, 186)); + scene->_redLights.animate(ANIM_MODE_8, 0, NULL); + scene->_redLights._numFrames = 5; + scene->_redLights.setAction(&scene->_sequenceManager, scene, 61, NULL); if (scene->_slaveButton._state) scene->_slaveButton.setFrame(2); - if (scene->_object8._state) - scene->_object8.setFrame(2); + if (scene->_masterButton._state) + scene->_masterButton.setFrame(2); _globals->_sceneItems.push_front(&scene->_item1); - _globals->_sceneItems.push_front(&scene->_object6); + _globals->_sceneItems.push_front(&scene->_controlButton); _globals->_sceneItems.push_front(&scene->_slaveButton); - _globals->_sceneItems.push_front(&scene->_object8); + _globals->_sceneItems.push_front(&scene->_masterButton); _globals->_sceneItems.push_back(&scene->_item2); _globals->gfxManager()._font.setFontNumber(2); @@ -2074,7 +2110,7 @@ void Scene60::Object4::doAction(int action) { } } -void Scene60::Object5::doAction(int action) { +void Scene60::MessageObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -2087,7 +2123,7 @@ void Scene60::Object5::doAction(int action) { } } -void Scene60::Object6::doAction(int action) { +void Scene60::ControlObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -2114,7 +2150,7 @@ void Scene60::SlaveObject::doAction(int action) { if (action == CURSOR_LOOK) { SceneItem::display2(60, 8); } else if (action == CURSOR_USE) { - if (scene->_object8._state) + if (scene->_masterButton._state) scene->_sceneMode = 19; else if (_state) { scene->_soundHandler3.proc3(); @@ -2138,20 +2174,22 @@ void Scene60::SlaveObject::doAction(int action) { } } -void Scene60::Object8::doAction(int action) { +void Scene60::MasterObject::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { SceneItem::display2(60, 7); } else if (action == CURSOR_USE) { - if (!scene->_object8._state) + if (!scene->_controlButton._animateMode) scene->_sceneMode = 14; + else if (scene->_slaveButton._state) + scene->_sceneMode = 20; else if (_state) { scene->_soundHandler3.proc3(); animate(ANIM_MODE_6, NULL); + _state = 0; _globals->clearFlag(103); _globals->clearFlag(!_globals->_stripNum ? 116 : 119); - _state = 0; scene->_sceneMode = 9998; } else { scene->_soundHandler3.startSound(39); @@ -2168,7 +2206,7 @@ void Scene60::Object8::doAction(int action) { } } -void Scene60::Object9::doAction(int action) { +void Scene60::FloppyDrive::doAction(int action) { Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { @@ -2188,7 +2226,7 @@ void Scene60::Item1::doAction(int action) { switch (action) { case OBJECT_INFODISK: - _globals->_inventory._infoDisk._sceneNumber = 60; + RING_INVENTORY._infoDisk._sceneNumber = 60; _globals->setFlag(!_globals->_stripNum ? 118 : 121); scene->_sceneMode = 0; scene->setAction(&scene->_action1); @@ -2197,7 +2235,7 @@ void Scene60::Item1::doAction(int action) { SceneItem::display2(60, 10); break; case CURSOR_USE: - if (_globals->_inventory._infoDisk._sceneNumber == 60) { + if (RING_INVENTORY._infoDisk._sceneNumber == 60) { if (_globals->getFlag(118) && !_globals->_stripNum) { _globals->clearFlag(118); scene->setAction(&scene->_action1); @@ -2210,7 +2248,7 @@ void Scene60::Item1::doAction(int action) { scene->_action1.setActionIndex(9); scene->_action1.setDelay(1); } - } else if (_globals->_inventory._infoDisk._sceneNumber == 1) { + } else if (RING_INVENTORY._infoDisk._sceneNumber == 1) { scene->_sceneMode = 0; setAction(&scene->_sequenceManager, scene, 62, NULL); } else { @@ -2264,20 +2302,20 @@ void Scene60::postInit(SceneObjectList *OwnerList) { _slaveButton.setPosition(Common::Point(143, 125)); _slaveButton._state = 0; - _object8.postInit(); - _object8.setVisage(60); - _object8.setStrip(8); - _object8.setPosition(Common::Point(143, 105)); - _object8._state = 0; + _masterButton.postInit(); + _masterButton.setVisage(60); + _masterButton.setStrip(8); + _masterButton.setPosition(Common::Point(143, 105)); + _masterButton._state = 0; - _globals->_sceneItems.push_back(&_object8); + _globals->_sceneItems.push_back(&_masterButton); _globals->_sceneItems.push_back(&_slaveButton); - _object6.postInit(); - _object6.setVisage(60); - _object6.setStrip(5); - _object6.setPosition(Common::Point(233, 143)); - _globals->_sceneItems.push_back(&_object6); + _controlButton.postInit(); + _controlButton.setVisage(60); + _controlButton.setStrip(5); + _controlButton.setPosition(Common::Point(233, 143)); + _globals->_sceneItems.push_back(&_controlButton); if (_globals->_stripNum == -1) { _globals->_stripNum = 0; @@ -2297,29 +2335,29 @@ void Scene60::postInit(SceneObjectList *OwnerList) { } if (_globals->getFlag(116)) { - _object8._state = 1; - _object8.setFrame(2); + _masterButton._state = 1; + _masterButton.setFrame(2); } if (_globals->getFlag(118)) { - _object6.animate(ANIM_MODE_2, NULL); + _controlButton.animate(ANIM_MODE_2, NULL); - _object10.postInit(); - _object10.setVisage(60); - _object10.setPosition(Common::Point(199, 186)); - _object10.animate(ANIM_MODE_8, 0, NULL); + _redLights.postInit(); + _redLights.setVisage(60); + _redLights.setPosition(Common::Point(199, 186)); + _redLights.animate(ANIM_MODE_8, 0, NULL); _soundHandler1.startSound(35); if (!_globals->getFlag(83)) { - _object5.postInit(); - _object5.setVisage(60); - _object5.setStrip2(3); - _object5.setFrame(2); - _object5.setPosition(Common::Point(148, 85)); - _object5.animate(ANIM_MODE_2, NULL); - _object5._numFrames = 5; - _globals->_sceneItems.push_front(&_object5); + _message.postInit(); + _message.setVisage(60); + _message.setStrip2(3); + _message.setFrame(2); + _message.setPosition(Common::Point(148, 85)); + _message.animate(ANIM_MODE_2, NULL); + _message._numFrames = 5; + _globals->_sceneItems.push_front(&_message); _soundHandler2.startSound(38); } @@ -2331,30 +2369,30 @@ void Scene60::postInit(SceneObjectList *OwnerList) { } if (_globals->getFlag(119)) { - _object8._state = 1; - _object8.setFrame(2); + _masterButton._state = 1; + _masterButton.setFrame(2); } if (_globals->getFlag(121)) { - _object6.animate(ANIM_MODE_2, NULL); + _controlButton.animate(ANIM_MODE_2, NULL); - _object10.postInit(); - _object10.setVisage(60); - _object10.setPosition(Common::Point(199, 186)); - _object10.animate(ANIM_MODE_8, 0, NULL); - _object10._numFrames = 5; + _redLights.postInit(); + _redLights.setVisage(60); + _redLights.setPosition(Common::Point(199, 186)); + _redLights.animate(ANIM_MODE_8, 0, NULL); + _redLights._numFrames = 5; _soundHandler1.startSound(35); if (!_globals->getFlag(83)) { - _object5.postInit(); - _object5.setVisage(60); - _object5.setStrip2(3); - _object5.setFrame(2); - _object5.setPosition(Common::Point(148, 85)); - _object5.animate(ANIM_MODE_2, NULL); - _object5._numFrames = 5; - _globals->_sceneItems.push_front(&_object5); + _message.postInit(); + _message.setVisage(60); + _message.setStrip2(3); + _message.setFrame(2); + _message.setPosition(Common::Point(148, 85)); + _message.animate(ANIM_MODE_2, NULL); + _message._numFrames = 5; + _globals->_sceneItems.push_front(&_message); _soundHandler2.startSound(38); } @@ -2374,7 +2412,7 @@ void Scene60::signal() { _globals->_events.setCursor(CURSOR_USE); _gfxButton.setText(EXIT_MSG); - _gfxButton._bounds.centre(160, 193); + _gfxButton._bounds.center(160, 193); _gfxButton.draw(); _gfxButton._bounds.expandPanes(); } else { @@ -2387,7 +2425,7 @@ void Scene60::signal() { void Scene60::process(Event &event) { Scene::process(event); - if (_sceneNumber == 60) { + if (_screenNumber == 60) { if (_gfxButton.process(event)) _globals->_sceneManager.changeScene(50); } @@ -2474,7 +2512,7 @@ void Scene90::Action1::signal() { scene->_object3.animate(ANIM_MODE_6, NULL); SceneItem::display(90, _globals->getFlag(104) ? 15 : 14, - SET_EXT_BGCOLOUR, 13, SET_KEEP_ONSCREEN, -1, SET_X, 120, SET_Y, 20, LIST_END); + SET_EXT_BGCOLOR, 13, SET_KEEP_ONSCREEN, -1, SET_X, 120, SET_Y, 20, LIST_END); break; case 12: SceneItem::display(0, 0); @@ -2611,7 +2649,7 @@ void Scene90::postInit(SceneObjectList *OwnerList) { _object3.setVisage(90); _object3.animate(ANIM_MODE_1, NULL); _object3.setPosition(Common::Point(196, 181)); - _object3.setPriority2(175); + _object3.fixPriority(175); _globals->_sceneItems.push_back(&_object3); _globals->_player.disableControl(); @@ -2636,7 +2674,7 @@ void Scene90::signal() { break; case 92: _globals->_scenePalette.clearListeners(); - _globals->_game.endGame(90, 6); + _globals->_game->endGame(90, 6); break; case 96: _globals->_player.enableControl(); @@ -2667,7 +2705,7 @@ void Scene95::Action1::signal() { case 1: if (_state) { SceneItem::display(95, _state % 2, SET_FONT, 2, - SET_EXT_BGCOLOUR, -1, SET_EXT_BGCOLOUR, 20, + SET_EXT_BGCOLOR, -1, SET_EXT_BGCOLOR, 20, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, SET_TEXT_MODE, 1, LIST_END); --_state; _actionIndex = 1; @@ -2701,7 +2739,7 @@ void Scene95::Action1::signal() { scene->_object1.addMover(mover2, &pt2, NULL); SceneItem::display(95, 2, SET_Y, 45, SET_FONT, 2, - SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 13, SET_WIDTH, 200, + SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 13, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(240); break; @@ -2710,13 +2748,13 @@ void Scene95::Action1::signal() { scene->_object3.remove(); SceneItem::display(95, 3, SET_Y, 45, SET_FONT, 2, - SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200, + SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(240); break; case 5: SceneItem::display(95, 4, SET_Y, 45, SET_FONT, 2, - SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200, + SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(240); break; @@ -2841,7 +2879,7 @@ void Scene6100::Action3::signal() { break; case 1: _globals->_scenePalette.clearListeners(); - scene->_fadePercent = 0; + scene->_fadePercent = 100; _globals->_scenePalette.refresh(); scene->loadScene(9997); scene->_object1.hide(); @@ -2852,7 +2890,7 @@ void Scene6100::Action3::signal() { scene->_sunflower3.hide(); scene->_rocks.hide(); scene->_sceneText.hide(); - + _globals->_events.setCursor(CURSOR_WALK); scene->_stripManager.start(8120, this); break; @@ -2957,39 +2995,39 @@ void Scene6100::Action5::dispatch() { } scene->_objList[idx]->_flags |= OBJFLAG_PANES; -/* + if ((idx != 3) && (scene->_fadePercent == 100) && - (tempSet.sqrt(floatSet) < 150.0)) { + (tempSet.sqrt(zeroSet) < 150.0)) { switch (scene->_hitCount++) { case 1: scene->_soundHandler.startSound(233); - scene->showMessage(0, NULL, 0); + scene->showMessage(NULL, 0, NULL); if (!_globals->getFlag(76)) - scene->_object5.setAction(&scene->_action2); + scene->_probe.setAction(&scene->_action2); + break; case 2: scene->_soundHandler.startSound(234); - scene->showMessage(0, NULL, 0); + scene->showMessage(NULL, 0, NULL); if (!_globals->getFlag(76)) - scene->_object5.setAction(NULL); + scene->_probe.setAction(NULL); scene->setAction(&scene->_action3); break; default: scene->_soundHandler.startSound(233); - scene->showMessage(0, NULL, 0); + scene->showMessage(NULL, 0, NULL); if (!_globals->getFlag(76)) - scene->_object5.setAction(&scene->_action1); + scene->_probe.setAction(&scene->_action1); break; } _globals->_scenePalette.clearListeners(); scene->_fadePercent = 0; } - */ } } @@ -3091,6 +3129,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { loadScene(6100); Scene::postInit(); setZoomPercents(62, 2, 200, 425); + _globals->_sceneHandler._delayTicks = 8; _globals->_player.disableControl(); _globals->_events.setCursor(CURSOR_WALK); @@ -3102,28 +3141,28 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _object1._frame = 1; _object1._strip = 4; _object1.setPosition(Common::Point(0, 60)); - _object1.setPriority2(1); + _object1.fixPriority(1); _object2.postInit(); _object2.setVisage(6100); _object2._frame = 1; _object2._strip = 4; _object2.setPosition(Common::Point(160, 60)); - _object2.setPriority2(1); + _object2.fixPriority(1); _object3.postInit(); _object3.setVisage(6100); _object3._frame = 1; _object3._strip = 4; _object3.setPosition(Common::Point(320, 60)); - _object3.setPriority2(1); + _object3.fixPriority(1); _rocks.postInit(); _rocks.setVisage(6100); _rocks._frame = 1; _rocks._strip = 3; _rocks.setPosition(Common::Point(320, 0)); - _rocks.setPriority2(2); + _rocks.fixPriority(2); _rocks.changeZoom(-1); _rocks._floats._float1 = 320.0; _rocks._floats._float2 = 25000.0; @@ -3135,7 +3174,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _probe._frame = 1; _probe._strip = 5; _probe.setPosition(Common::Point(160, 260)); - _probe.setPriority2(3); + _probe.fixPriority(3); _probe._floats._float1 = 320.0; _probe._floats._float2 = 0.0; _probe._floats._float3 = 0.0; @@ -3160,7 +3199,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) { _objList[idx]->setPosition(Common::Point( _globals->_randomSource.getRandomNumber(319), 60)); - _objList[idx]->setPriority2(1); + _objList[idx]->fixPriority(1); _objList[idx]->changeZoom(-1); } @@ -3193,9 +3232,9 @@ void Scene6100::process(Event &event) { if (event.eventType == EVENT_KEYPRESS) { // Handle incremental turning speeds with arrow keys if ((event.kbd.keycode == Common::KEYCODE_LEFT) || (event.kbd.keycode == Common::KEYCODE_KP4)) { - _turnAmount = MAX(_turnAmount - 1, -8); + _turnAmount = MIN(_turnAmount + 1, 8); } else if ((event.kbd.keycode == Common::KEYCODE_RIGHT) || (event.kbd.keycode == Common::KEYCODE_KP6)) { - _turnAmount = MIN(_turnAmount + 1, -8); + _turnAmount = MAX(_turnAmount - 1, -8); } } @@ -3231,7 +3270,7 @@ void Scene6100::dispatch() { _sceneText.setPosition(Common::Point(24, 160)); _sceneText._fontNumber = 0; - _sceneText._colour1 = 35; + _sceneText._color1 = 35; _sceneText.setup(s); } @@ -3244,7 +3283,7 @@ void Scene6100::dispatch() { } } -void Scene6100::showMessage(const Common::String &msg, int colour, Action *action) { +void Scene6100::showMessage(const Common::String &msg, int color, Action *action) { if (_msgActive) { _msgActive = false; _speaker1.removeText(); @@ -3254,7 +3293,7 @@ void Scene6100::showMessage(const Common::String &msg, int colour, Action *actio _msgActive = true; _speaker1._textPos.x = 20; _speaker1._textWidth = 280; - _speaker1._colour1 = colour; + _speaker1._color1 = color; _speaker1._action = action; _speaker1.setText(msg); } diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h index b567aeea2d..be6d8e6337 100644 --- a/engines/tsage/ringworld_scenes1.h +++ b/engines/tsage/ringworld_scenes1.h @@ -114,34 +114,13 @@ class Scene30 : public Scene { // Doorway beam sensor class BeamObject : public SceneObject { public: - virtual void doAction(int action) { - if (action == OBJECT_SCANNER) - display(30, 14, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - else if (action == CURSOR_LOOK) - display(30, 2, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - else if (action == CURSOR_USE) { - Scene30 *parent = (Scene30 *)_globals->_sceneManager._scene; - parent->setAction(&parent->_beamAction); - } else - SceneObject::doAction(action); - } + virtual void doAction(int action); }; - // Doorway object class DoorObject : public SceneObject { public: - virtual void doAction(int action) { - if (action == OBJECT_SCANNER) - display(30, 13, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - else if (action == CURSOR_LOOK) - display(30, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - else if (action == CURSOR_USE) - display(30, 7, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - else - SceneObject::doAction(action); - } + virtual void doAction(int action); }; - // Kzin object class KzinObject : public SceneObject { public: @@ -344,23 +323,23 @@ class Scene60 : public Scene { public: virtual void signal(); }; - class Object2 : public SceneObject { + class PrevObject : public SceneObject { public: virtual void doAction(int action); }; - class Object3 : public SceneObject { + class NextObject : public SceneObject { public: virtual void doAction(int action); }; - class Object4 : public SceneObject { + class ExitObject : public SceneObject { public: virtual void doAction(int action); }; - class Object5 : public SceneObject { + class MessageObject : public SceneObject { public: virtual void doAction(int action); }; - class Object6 : public SceneObject { + class ControlObject : public SceneObject { public: virtual void doAction(int action); }; @@ -368,11 +347,11 @@ class Scene60 : public Scene { public: virtual void doAction(int action); }; - class Object8 : public SceneObjectExt { + class MasterObject : public SceneObjectExt { public: virtual void doAction(int action); }; - class Object9 : public SceneObject { + class FloppyDrive : public SceneObject { public: virtual void doAction(int action); }; @@ -399,16 +378,16 @@ public: SpeakerSText _speakerSText; Action1 _action1; Action2 _action2; - SceneObject _object1; - Object2 _object2; - Object3 _object3; - Object4 _object4; - Object5 _object5; - Object6 _object6; + SceneObject _rose; + PrevObject _prevButton; + NextObject _nextButton; + ExitObject _exitButton; + MessageObject _message; + ControlObject _controlButton; SlaveObject _slaveButton; - Object8 _object8; - Object9 _object9; - SceneObject _object10; + MasterObject _masterButton; + FloppyDrive _floppyDrive; + SceneObject _redLights; Item1 _item1; Item _item2, _item3, _item4, _item5, _item6; SoundHandler _soundHandler1; @@ -548,7 +527,7 @@ public: virtual void remove(); virtual void process(Event &event); virtual void dispatch(); - void showMessage(const Common::String &msg, int colour, Action *action); + void showMessage(const Common::String &msg, int color, Action *action); }; diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 30a0ffd34e..65e415748d 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -38,7 +38,8 @@ Scene2::Scene2() : Scene() { /*--------------------------------------------------------------------------*/ void Object9350::postInit(SceneObjectList *OwnerList) { - _globals->_sceneManager.postInit(&_globals->_sceneManager._altSceneObjects); + //SceneObject::postInit(&_globals->_sceneManager._altSceneObjects); + SceneObject::postInit(OwnerList); } void Object9350::draw() { @@ -66,7 +67,7 @@ void Scene9100::SceneHotspot1::doAction(int action) { _globals->_player.disableControl(); scene->_sceneMode = 9105; } - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, &scene->_object5, &scene->_object6, 0); + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, &scene->_object5, &scene->_object6, NULL); } else { NamedHotspot::doAction(action); } @@ -77,16 +78,16 @@ void Scene9100::dispatch() { if (!_action) { if (_globals->_player._position.x < 25) { - if (!_globals->getFlag(11)) { - scene->_sceneMode = 9106; - } else { - scene->_sceneMode = 9108; + _globals->_player.disableControl(); + if (!_globals->getFlag(23) || _globals->getFlag(11)) + _sceneMode = 9106; + else { + _sceneMode = 9108; _globals->setFlag(11); } - } else { - scene->_sceneMode = 9106; + + scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, NULL); } - scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, 0); } else { Scene::dispatch(); } @@ -102,7 +103,7 @@ void Scene9100::signal() { _globals->_sceneManager.changeScene(9150); break; case 9105: - _sceneHotspot1.remove(); + _sceneHotspot3.remove(); // No break on purpose case 9103: case 9104: @@ -115,17 +116,15 @@ void Scene9100::signal() { } void Scene9100::postInit(SceneObjectList *OwnerList) { - Scene9100 *scene = (Scene9100 *)_globals->_sceneManager._scene; - Scene::postInit(); setZoomPercents(0, 100, 200, 100); _object1.postInit(); _object1.setVisage(9100); _object1._strip = 1; _object1._numFrames = 6; - _object1.setPosition(Common::Point(297, 132), 0); - _object1.animate(ANIM_MODE_2, 0); - _object1.setPriority2(10); + _object1.setPosition(Common::Point(279, 132)); + _object1.animate(ANIM_MODE_2, NULL); + _object1.fixPriority(10); _globals->_player.postInit(); @@ -146,7 +145,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { _object6.setVisage(9111); _object6.setStrip(6); _object6.setFrame(1); - _object6.setPosition(Common::Point(138, 166), 0); + _object6.setPosition(Common::Point(138, 166)); _sceneHotspot3.setup(145, 125, 166, 156, 9100, 40, 43); } _sceneHotspot1.setup(140, 176, 185, 215, 9100, 36, 37); @@ -155,7 +154,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { _sceneHotspot5.setup(69, 36, 121, 272, 9100, 45, 46); _sceneHotspot6.setup(127, 0, 200, 52, 9100, 47, 48); - _globals->_soundHandler.startSound(251, 0, 127); + _globals->_soundHandler.startSound(251); if (_globals->_sceneManager._previousScene == 9150) { if (_globals->getFlag(20)) { _globals->_player.disableControl(); @@ -163,17 +162,17 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { _sceneMode = 9107; else _sceneMode = 9109; - setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object5, 0); + setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object5, NULL); } else { _sceneMode = 9103; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, 0); + setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL); _globals->setFlag(20); } } else { _sceneMode = 9102; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, 0); + setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL); } } @@ -224,7 +223,7 @@ void Scene9150::dispatch() { if ((_sceneState != 0) && (_sceneBounds.left == 0)) { _object3._timer = 0; _sceneState = 0; - _sceneHotspot3.setAction(&_sequenceManager2, 0, 9154, &_object3, 0); + _object3.setAction(&_sequenceManager2, NULL, 9154, &_object3, NULL); _sceneHotspot10.remove(); } @@ -235,17 +234,17 @@ void Scene9150::dispatch() { if (_globals->_player._position.x > 630) { _globals->_player.disableControl(); _sceneMode = 9157; - setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0); + setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL); } } else { _globals->_player.disableControl(); if (_globals->getFlag(11)) { - _globals->_soundHandler.startSound(286, 0, 127); + _globals->_soundHandler.startSound(286); _sceneMode = 9153; } else { _sceneMode = 9156; } - setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0); + setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL); } } } @@ -260,7 +259,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { _object3.setVisage(9151); _object3._strip = 1; _object3._frame = 1; - _object3.setPosition(Common::Point(312, 95), 0); + _object3.setPosition(Common::Point(312, 95)); _object3.signal(); _sceneHotspot1.setup(0, 0, 200, 94, 9150, 46, -1); @@ -274,7 +273,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { _sceneHotspot8.setup(133, 584, 142, 640, 9150, 57, -1); _sceneHotspot10.setup(83, 304, 103, 323, 9150, 58, 59); - _globals->_soundHandler.startSound(285, 0, 127); + _globals->_soundHandler.startSound(285); _globals->_player.disableControl(); if (_globals->getFlag(20)) { @@ -286,14 +285,14 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { else // Hero wearing Purple suit _sceneMode = 9152; - setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0); + setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL); } else { // Walking with the tiger _sceneMode = 9151; _object2.postInit(); _object2.hide(); _object1.postInit(); - setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, &_object1, &_object2, 0); + setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, &_object1, &_object2, NULL); } } @@ -308,16 +307,16 @@ void Scene9200::SceneHotspot1::doAction(int action) { _globals->_player.disableControl(); if (_globals->getFlag(93)) { scene->_sceneState = 9214; - setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL); } else { _globals->setFlag(93); scene->_sceneState = 9213; - setAction(&scene->_sequenceManager, scene, 9213, &_globals->_player, &scene->_object2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9213, &_globals->_player, &scene->_object2, NULL); } } else if (action <= 100) { _globals->_player.disableControl(); scene->_sceneState = 9214; - setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL); } else { NamedHotspot::doAction(action); } @@ -365,27 +364,27 @@ void Scene9200::dispatch() { if ( (_globals->_player._position.x <= 0) || ((_globals->_player._position.x < 100) && (_globals->_player._position.y > 199))) { _globals->_player.disableControl(); _sceneState = 9209; - setAction(&_sequenceManager, this, 9209, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9209, &_globals->_player, &_object2, &_object3, NULL); } else { if (rect9200.contains(_globals->_player._position)) { if (_globals->getFlag(93)) { if (_globals->getFlag(86)) { _sceneState = 9215; - setAction(&_sequenceManager, this, 9215, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9215, &_globals->_player, &_object2, &_object3, NULL); } else { _sceneState = 9208; - setAction(&_sequenceManager, this, 9208, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9208, &_globals->_player, &_object2, &_object3, NULL); } } else { _globals->_player.disableControl(); _sceneState = 9204; - setAction(&_sequenceManager, this, 9204, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9204, &_globals->_player, &_object2, &_object3, NULL); } } else { if (_globals->_player._position.y < 140) { _globals->_player.disableControl(); _sceneState = 9207; - setAction(&_sequenceManager, this, 9207, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9207, &_globals->_player, &_object2, &_object3, NULL); } } } @@ -403,10 +402,10 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { // Water animation _object1.setVisage(9200); _object1._strip = 3; - _object1.animate(ANIM_MODE_2, 0); - _object1.setPosition(Common::Point(132, 114), 0); - _object1.setPriority2(140); - _soundHandler.startSound(297, 0, 127); + _object1.animate(ANIM_MODE_2, NULL); + _object1.setPosition(Common::Point(132, 114)); + _object1.fixPriority(140); + _soundHandler.startSound(297); _stripManager.addSpeaker(&_speakerQText); _stripManager.addSpeaker(&_speakerGR); _stripManager.addSpeaker(&_speakerGText); @@ -429,41 +428,45 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { switch (_globals->_sceneManager._previousScene) { case 9500: if (_globals->getFlag(85)) { - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _globals->setFlag(86); + _globals->_player.disableControl(); _sceneState = 9210; - setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, NULL); } else { + _globals->_player.disableControl(); _sceneState = 9212; - setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, NULL); } } else { - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { + _globals->_player.disableControl(); _sceneState = 9211; - setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, NULL); } else { + _globals->_player.disableControl(); _sceneState = 9202; - setAction(&_sequenceManager, this, 9202, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9202, &_globals->_player, &_object2, &_object3, NULL); } } break; case 9700: if (_globals->getFlag(86)) { _sceneState = 9206; - setAction(&_sequenceManager, this, 9206, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9206, &_globals->_player, &_object2, &_object3, NULL); } else { _sceneState = 9203; - setAction(&_sequenceManager, this, 9203, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9203, &_globals->_player, &_object2, &_object3, NULL); } break; case 9360: default: if (_globals->getFlag(86)) { _sceneState = 9205; - setAction(&_sequenceManager, this, 9205, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9205, &_globals->_player, &_object2, &_object3, NULL); } else { _sceneState = 9201; - setAction(&_sequenceManager, this, 9201, &_globals->_player, &_object2, &_object3, 0); + setAction(&_sequenceManager, this, 9201, &_globals->_player, &_object2, &_object3, NULL); } break; } @@ -479,7 +482,7 @@ void Scene9300::signal() { _globals->setFlag(84); // No break on purpose case 9303: - _globals->_soundHandler.startSound(295, 0, 127); + _globals->_soundHandler.startSound(295); _globals->_sceneManager.changeScene(9350); break; case 9302: @@ -496,7 +499,7 @@ void Scene9300::dispatch() { } else if (_globals->_player._position.y < 145) { _globals->_player.disableControl(); _sceneMode = 9303; - setAction(&_sequenceManager, this, 9303, &_globals->_player, &_object1, &_object2, 0); + setAction(&_sequenceManager, this, 9303, &_globals->_player, &_object1, &_object2, NULL); } } @@ -509,7 +512,7 @@ void Scene9300::postInit(SceneObjectList *OwnerList) { _globals->_player.changeZoom(-1); _object1.postInit(); _object2.postInit(); - _globals->_soundHandler.startSound(289, 0, 127); + _globals->_soundHandler.startSound(289); _hotspot1.setup(35, 142, 76, 212, 9300, 0, 1); _hotspot2.setup(28, 90, 81, 143, 9300, 2, 3); @@ -528,11 +531,11 @@ void Scene9300::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneManager._previousScene == 9350) { _globals->_player.disableControl(); _sceneMode = 9302; - setAction(&_sequenceManager, this, 9302, &_globals->_player, &_object1, &_object2, 0); + setAction(&_sequenceManager, this, 9302, &_globals->_player, &_object1, &_object2, NULL); } else { _globals->_player.disableControl(); _sceneMode = 9301; - setAction(&_sequenceManager, this, 9301, &_globals->_player, &_object1, &_object2, 0); + setAction(&_sequenceManager, this, 9301, &_globals->_player, &_object1, &_object2, NULL); } } @@ -569,15 +572,15 @@ void Scene9350::dispatch() { if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) { _globals->_player.disableControl(); _sceneState = 9356; - setAction(&_sequenceManager, this, 9356, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9356, &_globals->_player, &_object2, NULL); } else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) { _globals->_player.disableControl(); _sceneState = 9357; - setAction(&_sequenceManager, this, 9357, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9357, &_globals->_player, &_object2, NULL); } else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) { _globals->_player.disableControl(); _sceneState = 9355; - setAction(&_sequenceManager, this, 9355, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9355, &_globals->_player, &_object2, NULL); } } else { Scene::dispatch(); @@ -589,7 +592,7 @@ void Scene9350::postInit(SceneObjectList *OwnerList) { setZoomPercents(95, 80, 200, 100); _globals->_player.postInit(); - _object1.setup(9350, 1, 3, 139, 97, 0); + _object1.setup(9351, 1, 3, 139, 97, 0); _sceneHotspot1.setup(42, 0, 97, 60, 9350, 0, -1); _sceneHotspot2.setup(37, 205, 82, 256, 9350, 0, -1); _sceneHotspot3.setup(29, 93, 92, 174, 9350, 1, -1); @@ -602,22 +605,22 @@ void Scene9350::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneManager._previousScene == 9360) { _globals->_player.disableControl(); _sceneState = 9352; - setAction(&_sequenceManager, this, 9352, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9352, &_globals->_player, &_object2, NULL); } else if (_globals->_sceneManager._previousScene == 9400) { _globals->_player.disableControl(); _sceneState = 9353; - setAction(&_sequenceManager, this, 9353, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9353, &_globals->_player, &_object2, NULL); } else { - if (!_globals->getFlag(84)) { + if (_globals->getFlag(84)) { _globals->clearFlag(84); _object2.postInit(); _globals->_player.disableControl(); _sceneState = 9359; - setAction(&_sequenceManager, this, 9359, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9359, &_globals->_player, &_object2, NULL); } else { _globals->_player.disableControl(); _sceneState = 9354; - setAction(&_sequenceManager, this, 9354, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9354, &_globals->_player, &_object2, NULL); } } } @@ -654,15 +657,15 @@ void Scene9360::dispatch() { if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) { _globals->_player.disableControl(); _sceneState = 9366; - setAction(&_sequenceManager, this, 9366, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9366, &_globals->_player, NULL); } else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) { _globals->_player.disableControl(); _sceneState = 9367; - setAction(&_sequenceManager, this, 9367, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9367, &_globals->_player, NULL); } else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) { _globals->_player.disableControl(); _sceneState = 9365; - setAction(&_sequenceManager, this, 9365, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9365, &_globals->_player, NULL); } } else { Scene::dispatch(); @@ -687,15 +690,15 @@ void Scene9360::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneManager._previousScene == 9350) { _globals->_player.disableControl(); _sceneState = 9364; - setAction(&_sequenceManager, this, 9364, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9364, &_globals->_player, NULL); } else if (_globals->_sceneManager._previousScene == 9450) { _globals->_player.disableControl(); _sceneState = 9363; - setAction(&_sequenceManager, this, 9363, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9363, &_globals->_player, NULL); } else { _globals->_player.disableControl(); _sceneState = 9362; - setAction(&_sequenceManager, this, 9362, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9362, &_globals->_player, NULL); } _object1.setup(9351, 1, 1, 131, 90, 0); } @@ -711,9 +714,10 @@ Scene9400::Scene9400() { void Scene9400::SceneHotspot7::doAction(int action) { Scene9400 *scene = (Scene9400 *)_globals->_sceneManager._scene; - if ((action == CURSOR_USE) && (_globals->_inventory._straw._sceneNumber != 1)) { + if ((action == CURSOR_USE) && (RING_INVENTORY._straw._sceneNumber != 1)) { scene->_sceneState = 1; - scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, 0); + RING_INVENTORY._straw._sceneNumber = 1; + scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, NULL); } else { NamedHotspot::doAction(action); } @@ -739,7 +743,7 @@ void Scene9400::signal() { break; case 1: _object1._numFrames = 6; - _object1.animate(ANIM_MODE_2, 0); + _object1.animate(ANIM_MODE_2, NULL); _globals->_player.enableControl(); break; case 2: @@ -763,7 +767,7 @@ void Scene9400::signal() { void Scene9400::dispatch() { if ((_object1._animateMode == 2) && (_object1._strip == 1) && (_object1._frame == 4)){ if (_field1032 == 0) { - _soundHandler.startSound(296, 0, 127); + _soundHandler.startSound(296); _field1032 = 1; } } else { @@ -785,11 +789,11 @@ void Scene9400::dispatch() { void Scene9400::postInit(SceneObjectList *OwnerList) { Scene::postInit(); - _sceneNumber = 9400; + _screenNumber = 9400; setZoomPercents(0, 100, 200, 100); _globals->_player.postInit(); - _object1.postInit(0); - _object3.postInit(0); + _object1.postInit(); + _object3.postInit(); _speakerQText._textPos.x = 20; _hotspot7.setup(157, 66, 180, 110, 9400, 21, 23); @@ -815,7 +819,7 @@ void Scene9400::postInit(SceneObjectList *OwnerList) { _sceneState = 0; } - setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, 0); + setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, NULL); } /*-------------------------------------------------------------------------- @@ -825,7 +829,7 @@ void Scene9400::postInit(SceneObjectList *OwnerList) { void Scene9450::Object2::signal() { Scene9450 *scene = (Scene9450 *)_globals->_sceneManager._scene; - this->setAction(&scene->_sequenceManager3, this, 9458, &scene->_object1, 0); + this->setAction(&scene->_sequenceManager3, this, 9458, this, &scene->_object1, NULL); } void Scene9450::Object3::dispatch() { @@ -841,7 +845,7 @@ void Scene9450::Hotspot1::doAction(int action) { scene->_object2._action->remove(); scene->_sceneMode = 9459; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, 0); + scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL); } else { NamedHotspot::doAction(action); } @@ -856,35 +860,35 @@ void Scene9450::Hotspot3::doAction(int action) { case OBJECT_TUNIC2: scene->_sceneMode = 9460; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, 0); + scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL); break; case OBJECT_TUNIC: - SceneItem::display(9450, 49, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9450, 49, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_WALK: // nothing break; case CURSOR_LOOK: - SceneItem::display(9450, 41, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9450, 41, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_USE: case CURSOR_TALK: - if (_globals->_inventory._tunic._sceneNumber == 9450) { + if (RING_INVENTORY._tunic._sceneNumber == 9450) { if (scene->_object2._action) scene->_object2._action->remove(); scene->_sceneMode = 9459; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, 0); - } else if ((_globals->_inventory._cloak._sceneNumber != 1) && (_globals->_inventory._jacket._sceneNumber != 1) && (_globals->_inventory._tunic2._sceneNumber != 1)) { - SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL); + } else if ((RING_INVENTORY._cloak._sceneNumber != 1) && (RING_INVENTORY._jacket._sceneNumber != 1) && (RING_INVENTORY._tunic2._sceneNumber != 1)) { + SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else { scene->_sceneMode = 9460; _globals->_player.disableControl(); - setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, 0); + scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL); } break; default: - SceneItem::display(9450, 45, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9450, 45, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; } } @@ -894,11 +898,11 @@ void Scene9450::signal() { case 1002: case 1004: // Drink - setAction(&_sequenceManager1, this, 9456, &_object2, &_object1, &_object3, 0); + setAction(&_sequenceManager1, this, 9456, &_object2, &_object1, &_object3, NULL); break; case 1005: // Bring me more wine - setAction(&_sequenceManager1, this, 9457, &_object2, &_object1, &_object3, 0); + setAction(&_sequenceManager1, this, 9457, &_object2, &_object1, &_object3, NULL); break; case 9451: if (_globals->getFlag(87)) { @@ -907,18 +911,22 @@ void Scene9450::signal() { _sceneMode = 1001; if (_object2._action) _object2._action->remove(); + // Eat + setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, NULL); } - // No break on purpose + break; case 1001: case 1003: // Eat - setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, 0); + setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, NULL); break; case 9453: _globals->_sceneManager.changeScene(9360); break; case 9459: + RING_INVENTORY._tunic._sceneNumber = 1; _object2.signal(); + _globals->_player.enableControl(); _globals->_events.setCursor(CURSOR_WALK); _hotspot1.remove(); break; @@ -938,11 +946,11 @@ void Scene9450::dispatch() { if ((_globals->_player._position.y < 98) && (_globals->_player._position.x > 241) && (_globals->_player._position.x < 282)) { _globals->_player.disableControl(); _sceneMode = 9452; - setAction(&_sequenceManager1, this, 9452, &_globals->_player, 0); + setAction(&_sequenceManager1, this, 9452, &_globals->_player, NULL); } else if ((_globals->_player._position.y < 99) && (_globals->_player._position.x > 68) && (_globals->_player._position.x < 103)) { _globals->_player.disableControl(); _sceneMode = 9453; - setAction(&_sequenceManager1, this, 9453, &_globals->_player, 0); + setAction(&_sequenceManager1, this, 9453, &_globals->_player, NULL); } } } @@ -959,25 +967,25 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); _sceneMode = 9451; - setAction(&_sequenceManager1, this, 9451, &_globals->_player, 0); + setAction(&_sequenceManager1, this, 9451, &_globals->_player, NULL); if (_globals->getFlag(87)) { - if (_globals->_inventory._tunic._sceneNumber == 1) { + if (RING_INVENTORY._tunic._sceneNumber == 1) { _object2.signal(); } else { - _object2.setPosition(Common::Point(184, 144), 0); + _object2.setPosition(Common::Point(184, 144)); _object2.setVisage(9451); - _object2.setPriority2(250); + _object2.fixPriority(250); _object2._strip = 5; _object2._frame = 10; } } else { _object3.postInit(); _object3.hide(); - _object3.setAction(&_sequenceManager2, 0, 9455, &_object2, &_object1, 0); + _object3.setAction(&_sequenceManager2, NULL, 9455, &_object2, &_object1, NULL); } - if (_globals->_inventory._tunic._sceneNumber != 1) + if (RING_INVENTORY._tunic._sceneNumber != 1) _hotspot1.setup(123, 139, 138, 170, 9450, 37, -1); _hotspot2.setup(153, 102, 176, 141, 9450, 39, 40); @@ -1007,11 +1015,11 @@ void Scene9500::Hotspot1::doAction(int action) { if (action == OBJECT_SWORD) { scene->_sceneMode = 9510; _globals->setFlag(92); - _globals->_inventory._sword._sceneNumber = 9500; + RING_INVENTORY._sword._sceneNumber = 9500; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); scene->_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); - scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, NULL); } else { NamedHotspot::doAction(action); } @@ -1024,7 +1032,7 @@ void Scene9500::Hotspot2::doAction(int action) { scene->_sceneMode = 9511; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); - scene->setAction(&scene->_sequenceManager, scene, 9511, &_globals->_player, &scene->_object2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9511, &_globals->_player, &scene->_object2, NULL); } else { NamedHotspot::doAction(action); } @@ -1033,11 +1041,11 @@ void Scene9500::Hotspot2::doAction(int action) { void Scene9500::Hotspot3::doAction(int action) { Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene; - if ((action == CURSOR_USE) && (_globals->_inventory._candle._sceneNumber != 1)){ + if ((action == CURSOR_USE) && (RING_INVENTORY._candle._sceneNumber != 1)){ scene->_sceneMode = 9505; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); - scene->setAction(&scene->_sequenceManager, scene, 9505, &_globals->_player, &scene->_candle, 0); + scene->setAction(&scene->_sequenceManager, scene, 9505, &_globals->_player, &scene->_candle, NULL); } else { NamedHotspot::doAction(action); } @@ -1048,21 +1056,21 @@ void Scene9500::Hotspot4::doAction(int action) { if (action == OBJECT_CANDLE) { _globals->_player.disableControl(); - if (_globals->_inventory._straw._sceneNumber == 9500) { + if (RING_INVENTORY._straw._sceneNumber == 9500) { scene->_sceneMode = 9506; _globals->_sceneItems.remove(&scene->_hotspot5); _globals->_sceneItems.remove(this); - scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, 0); - _globals->_inventory._candle._sceneNumber = 9850; + scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, NULL); + RING_INVENTORY._candle._sceneNumber = 9850; } else { scene->_sceneMode = 9507; - scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, 0); + scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, NULL); } } else if (action == OBJECT_STRAW) { scene->_sceneMode = 9512; _globals->_player.disableControl(); - _globals->_inventory._straw._sceneNumber = 9500; - scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, 0); + RING_INVENTORY._straw._sceneNumber = 9500; + scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, NULL); } else { NamedHotspot::doAction(action); } @@ -1072,13 +1080,14 @@ void Scene9500::signal() { switch (_sceneMode) { case 9503: _globals->_sceneManager.changeScene(9200); - _globals->_soundHandler.startSound(295, 0, 127); + _globals->_soundHandler.startSound(295); break; case 9504: _globals->_sceneManager.changeScene(9850); break; case 9505: _candle.setStrip(2); + RING_INVENTORY._candle._sceneNumber = 1; _globals->_player.enableControl(); break; case 9506: @@ -1086,12 +1095,13 @@ void Scene9500::signal() { _globals->_player.enableControl(); break; case 9511: + RING_INVENTORY._helmet._sceneNumber = 1; _globals->_player.enableControl(); if (!_globals->getFlag(51)) { _globals->setFlag(51); _globals->_player.disableControl(); _sceneMode = 9514; - setAction(&_sequenceManager, this, 9514, &_globals->_player, 0, 0, 0, 0); + setAction(&_sequenceManager, this, 9514, &_globals->_player, NULL, NULL, NULL, NULL); } break; case 0: @@ -1109,11 +1119,11 @@ void Scene9500::dispatch() { if (_globals->_player._position.y >= 199) { _globals->_player.disableControl(); _sceneMode = 9503; - setAction(&_sequenceManager, this, 9503, &_globals->_player, 0, 0, 0, 0); + setAction(&_sequenceManager, this, 9503, &_globals->_player, NULL, NULL, NULL, NULL); } else if (_globals->_player._position.y < 127) { _globals->_player.disableControl(); _sceneMode = 9504; - setAction(&_sequenceManager, this, 9504, &_globals->_player, 0, 0, 0, 0); + setAction(&_sequenceManager, this, 9504, &_globals->_player, NULL, NULL, NULL, NULL); } } @@ -1128,21 +1138,21 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { setZoomPercents(110, 75, 200, 150); _globals->_player.postInit(); - _globals->_soundHandler.startSound(305, 0, 127); + _globals->_soundHandler.startSound(305); - _candle.postInit(0); + _candle.postInit(); _candle.setVisage(9500); _candle.setStrip(1); _candle.animate(ANIM_MODE_2); - _candle.setPosition(Common::Point(30, 105), 0); - if (_globals->_inventory._candle._sceneNumber != 9500) + _candle.setPosition(Common::Point(30, 105)); + if (RING_INVENTORY._candle._sceneNumber != 9500) _candle.setStrip(2); - _object3.postInit(0); + _object3.postInit(); _object3.hide(); - _object3.setPriority2(150); + _object3.fixPriority(150); _object3.setPosition(Common::Point(166, 133)); - if (_globals->_inventory._straw._sceneNumber == 9500) { + if (RING_INVENTORY._straw._sceneNumber == 9500) { _object3.show(); _object3.setVisage(5); _object3._strip = 2; @@ -1151,12 +1161,12 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { if (_globals->getFlag(85)) { _object3.setVisage(9500); _object3.setStrip(4); - _object3.animate(ANIM_MODE_8, 0, 0); + _object3.animate(ANIM_MODE_8, 0, NULL); _object3.setPosition(Common::Point(166, 133)); } } - _object2.postInit(0); + _object2.postInit(); _object2.hide(); if (_globals->getFlag(92)) { _object2.show(); @@ -1164,8 +1174,8 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { _object2.setStrip(1); _object2.setFrame(_object2.getFrameCount()); _object2.setPosition(Common::Point(303, 130)); - _object2.setPriority2(132); - if (_globals->_inventory._helmet._sceneNumber == 1) { + _object2.fixPriority(132); + if (RING_INVENTORY._helmet._sceneNumber == 1) { _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); } else { _object2.setStrip(2); @@ -1203,16 +1213,16 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { if ((_globals->_sceneManager._previousScene == 9200) || (_globals->_sceneManager._previousScene != 9850)) { _sceneMode = 0; - if (_globals->_inventory._helmet._sceneNumber != 1) { - setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, 0); + if (RING_INVENTORY._helmet._sceneNumber != 1) { + setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, NULL); } else { - _globals->_inventory._helmet._sceneNumber = 9500; + RING_INVENTORY._helmet._sceneNumber = 9500; _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); - setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, 0); + setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, NULL); } } else { _sceneMode = 0; - setAction(&_sequenceManager, this, 9502, &_globals->_player, &_candle, 0); + setAction(&_sequenceManager, this, 9502, &_globals->_player, &_candle, NULL); } } @@ -1228,34 +1238,35 @@ void Scene9700::signal() { case 9701: case 9702: _gfxButton1.setText(EXIT_MSG); - _gfxButton1._bounds.centre(50, 190); + _gfxButton1._bounds.center(50, 190); _gfxButton1.draw(); _gfxButton1._bounds.expandPanes(); _globals->_player.enableControl(); - _globals->_player._canWalk = 0; + _globals->_player._canWalk = false; _globals->_events.setCursor(CURSOR_USE); break; case 9704: - _globals->_soundHandler.startSound(323, 0, 127); + _globals->_soundHandler.startSound(323); _globals->_sceneManager.changeScene(9750); break; } } void Scene9700::process(Event &event) { - if ((event.eventType == EVENT_BUTTON_DOWN) && (event.kbd.keycode == 0)) { + Scene::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) { if (_gfxButton1.process(event)) { _globals->_sceneManager.changeScene(9200); } else if (_globals->_events._currentCursor == OBJECT_SCANNER) { event.handled = true; - if (_globals->_inventory._helmet._sceneNumber == 1) { + if (RING_INVENTORY._helmet._sceneNumber == 1) { _globals->_player.disableControl(); _sceneMode = 9704; - setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, 0); + setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, NULL); } else { _globals->_player.disableControl(); _sceneMode = 9703; - setAction(&_sequenceManager, this, 9703, &_globals->_player, &_object1, 0); + setAction(&_sequenceManager, this, 9703, &_globals->_player, &_object1, NULL); } } } @@ -1267,7 +1278,7 @@ void Scene9700::postInit(SceneObjectList *OwnerList) { _sceneHotspot1.setup(84, 218, 151, 278, 9700, 14, -1); _sceneHotspot2.setup(89, 11, 151, 121, 9700, 14, -1); - _sceneHotspot3.setup(69, 119, 138, 218, 9700, 15, 16); + _sceneHotspot3.setup(69, 119, 138, 216, 9700, 15, 16); _sceneHotspot4.setup(34, 13, 88, 116, 9700, 17, -1); _sceneHotspot5.setup(52, 119, 68, 204, 9700, 17, -1); _sceneHotspot6.setup(0, 22, 56, 275, 9700, 18, -1); @@ -1275,15 +1286,15 @@ void Scene9700::postInit(SceneObjectList *OwnerList) { _object1.postInit(); _object1.hide(); _globals->_player.postInit(); - if (_globals->getFlag(97)) { + if (!_globals->getFlag(97)) { _globals->_player.disableControl(); _sceneMode = 9701; - setAction(&_sequenceManager, this, 9701, &_globals->_player, &_object1, 0); + setAction(&_sequenceManager, this, 9701, &_globals->_player, &_object1, NULL); _globals->setFlag(97); } else { _globals->_player.disableControl(); _sceneMode = 9702; - setAction(&_sequenceManager, this, 9702, &_globals->_player, &_object1, 0); + setAction(&_sequenceManager, this, 9702, &_globals->_player, &_object1, NULL); } } @@ -1319,7 +1330,7 @@ void Scene9750::postInit(SceneObjectList *OwnerList) { _object2.hide(); _globals->_player.disableControl(); _sceneMode = 9751; - setAction(&_sequenceManager, this, 9751, &_globals->_player, &_object1, &_object2, 0); + setAction(&_sequenceManager, this, 9751, &_globals->_player, &_object1, &_object2, NULL); } @@ -1330,9 +1341,9 @@ void Scene9750::postInit(SceneObjectList *OwnerList) { void Scene9850::Object6::doAction(int action) { if ((_flags & OBJFLAG_HIDE) == 0) { if (action == CURSOR_LOOK) { - SceneItem::display(9850, 27, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 27, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else if (action == CURSOR_USE) { - _globals->_inventory._scimitar._sceneNumber = 1; + RING_INVENTORY._scimitar._sceneNumber = 1; hide(); } else { SceneHotspot::doAction(action); @@ -1342,9 +1353,9 @@ void Scene9850::Object6::doAction(int action) { void Scene9850::Object7::doAction(int action) { if ((_flags & OBJFLAG_HIDE) == 0) { if (action == CURSOR_LOOK) { - SceneItem::display(9850, 28, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 28, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else if (action == CURSOR_USE) { - _globals->_inventory._sword._sceneNumber = 1; + RING_INVENTORY._sword._sceneNumber = 1; hide(); } else { SceneHotspot::doAction(action); @@ -1357,21 +1368,21 @@ void Scene9850::Hotspot12::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._tunic2._sceneNumber != 1) { - _globals->_inventory._tunic2._sceneNumber = 1; + if (RING_INVENTORY._tunic2._sceneNumber != 1) { + RING_INVENTORY._tunic2._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9858; - setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, NULL); } else { - _globals->_inventory._tunic2._sceneNumber = 9850; + RING_INVENTORY._tunic2._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9861; - setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, 0); + scene->setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, NULL); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._tunic2._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._tunic2._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { - SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } } @@ -1379,21 +1390,21 @@ void Scene9850::Hotspot14::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._jacket._sceneNumber != 1) { - _globals->_inventory._jacket._sceneNumber = 1; + if (RING_INVENTORY._jacket._sceneNumber != 1) { + RING_INVENTORY._jacket._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9857; - setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, 0); + scene->setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, NULL); } else { - _globals->_inventory._jacket._sceneNumber = 9850; + RING_INVENTORY._jacket._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9860; - setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, 0); + scene->setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, NULL); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._jacket._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._jacket._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { - SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } } @@ -1401,21 +1412,21 @@ void Scene9850::Hotspot16::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { - if (_globals->_inventory._cloak._sceneNumber != 1) { - _globals->_inventory._cloak._sceneNumber = 1; + if (RING_INVENTORY._cloak._sceneNumber != 1) { + RING_INVENTORY._cloak._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 9862; - setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, 0); + scene->setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, NULL); } else { - _globals->_inventory._cloak._sceneNumber = 9850; + RING_INVENTORY._cloak._sceneNumber = 9850; _globals->_player.disableControl(); scene->_sceneMode = 9859; - setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, 0); + scene->setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, NULL); } - } else if ((action != CURSOR_LOOK) || (_globals->_inventory._cloak._sceneNumber != 1)) { + } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._cloak._sceneNumber != 1)) { NamedHotspot::doAction(action); } else { - SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } } @@ -1423,10 +1434,10 @@ void Scene9850::Hotspot17::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == OBJECT_SCANNER) { - SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else { if (action == CURSOR_USE) - scene->_soundHandler.startSound(306, 0, 127); + scene->_soundHandler.startSound(306); NamedHotspot::doAction(action); } } @@ -1435,10 +1446,10 @@ void Scene9850::Hotspot18::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == OBJECT_SCANNER) { - SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else { if (action == CURSOR_USE) - scene->_soundHandler.startSound(306, 0, 127); + scene->_soundHandler.startSound(306); NamedHotspot::doAction(action); } } @@ -1447,10 +1458,10 @@ void Scene9850::Hotspot19::doAction(int action) { Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene; if (action == OBJECT_SCANNER) { - SceneItem::display(9850, 31, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display(9850, 31, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); } else { if (action == CURSOR_USE) - scene->_soundHandler.startSound(313, 0, 127); + scene->_soundHandler.startSound(313); NamedHotspot::doAction(action); } } @@ -1462,15 +1473,15 @@ void Scene9850::Hotspot20::doAction(int action) { if (action == CURSOR_USE) { _globals->_player.disableControl(); if (scene->_objSword._state == 0) { - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) scene->_objScimitar.show(); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) scene->_objSword.show(); scene->_sceneMode = 11; - setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, 0); + setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL); } else { scene->_sceneMode = 10; - setAction(&scene->_sequenceManager, scene, 9854, &_globals->_player, &scene->_objDoor, &scene->_objLever, 0); + setAction(&scene->_sequenceManager, scene, 9854, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL); } scene->_objSword._state ^= 1; } else { @@ -1482,9 +1493,9 @@ void Scene9850::signal() { switch (_sceneMode ++) { case 10: // Hidden closet closed - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) _objScimitar.hide(); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) _objSword.hide(); _globals->_sceneItems.remove(&_objScimitar); _globals->_sceneItems.remove(&_objSword); @@ -1493,15 +1504,15 @@ void Scene9850::signal() { break; case 11: // Hidden closet opened - if (_globals->_inventory._scimitar._sceneNumber == 9850) + if (RING_INVENTORY._scimitar._sceneNumber == 9850) _globals->_sceneItems.addItems(&_objScimitar, NULL); - if (_globals->_inventory._sword._sceneNumber == 9850) + if (RING_INVENTORY._sword._sceneNumber == 9850) _globals->_sceneItems.addItems(&_objSword, NULL); _globals->_sceneItems.remove(&_hotspot19); _globals->_player.enableControl(); break; case 9500: - _globals->_sceneManager.changeScene(9500); + _globals->_sceneManager.changeScene(_sceneMode - 1); break; case 0: default: @@ -1517,10 +1528,10 @@ void Scene9850::process(Event &event) { _globals->_player.disableControl(); if (_objSword._state == 0) { _sceneMode = 0; - setAction(&_sequenceManager, this, 9853, &_objLever, &_objDoor, &_objScimitar, &_objSword, 0); + setAction(&_sequenceManager, this, 9853, &_objLever, &_objDoor, &_objScimitar, &_objSword, NULL); } else { _sceneMode = 10; - setAction(&_sequenceManager, this, 9854, &_objLever, &_objDoor, &_objScimitar, &_objSword, 0); + setAction(&_sequenceManager, this, 9854, &_objLever, &_objDoor, &_objScimitar, &_objSword, NULL); } _objSword._state ^= 1; } @@ -1532,7 +1543,7 @@ void Scene9850::dispatch() { } else if (_globals->_player._position.y >= 198) { _globals->_player.disableControl(); _sceneMode = 9500; - setAction(&_sequenceManager, this, 9852, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9852, &_globals->_player, NULL); } } @@ -1544,59 +1555,59 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objDoor.setVisage(9850); _objDoor.setStrip(1); _objDoor.setFrame(1); - _objDoor.setPosition(Common::Point(28, 118), 0); - _objDoor.setPriority2(90); + _objDoor.setPosition(Common::Point(28, 118)); + _objDoor.fixPriority(90); _objLever.postInit(); _objLever.setVisage(9850); _objLever.setStrip(4); _objLever.setFrame(1); - _objLever.setPosition(Common::Point(256, 35), 0); + _objLever.setPosition(Common::Point(256, 35)); _objCloak.postInit(); _objCloak.setVisage(9850); _objCloak.setStrip(5); _objCloak.setFrame(1); - _objCloak.setPriority2(90); - _objCloak.setPosition(Common::Point(157, 81), 0); - if (_globals->_inventory._cloak._sceneNumber != 9850) + _objCloak.fixPriority(90); + _objCloak.setPosition(Common::Point(157, 81)); + if (RING_INVENTORY._cloak._sceneNumber != 9850) _objCloak.hide(); _objJacket.postInit(); _objJacket.setVisage(9850); _objJacket.setStrip(5); _objJacket.setFrame(2); - _objJacket.setPriority2(90); + _objJacket.fixPriority(90); _objJacket.setPosition(Common::Point(201, 84)); - if (_globals->_inventory._jacket._sceneNumber != 9850) + if (RING_INVENTORY._jacket._sceneNumber != 9850) _objJacket.hide(); _objTunic2.postInit(); _objTunic2.setVisage(9850); _objTunic2.setStrip(5); _objTunic2.setFrame(3); - _objTunic2.setPriority2(90); + _objTunic2.fixPriority(90); _objTunic2.setPosition(Common::Point(295, 90)); - if (_globals->_inventory._tunic2._sceneNumber != 9850) + if (RING_INVENTORY._tunic2._sceneNumber != 9850) _objTunic2.hide(); - if (_globals->_inventory._scimitar._sceneNumber == 9850) { + if (RING_INVENTORY._scimitar._sceneNumber == 9850) { _objScimitar.postInit(); _objScimitar.setVisage(9850); _objScimitar.setStrip(2); _objScimitar.setFrame(1); - _objScimitar.setPosition(Common::Point(55, 83), 0); - _objScimitar.setPriority2(80); + _objScimitar.setPosition(Common::Point(55, 83)); + _objScimitar.fixPriority(80); _objScimitar.hide(); } - if (_globals->_inventory._sword._sceneNumber == 9850) { + if (RING_INVENTORY._sword._sceneNumber == 9850) { _objSword.postInit(); _objSword.setVisage(9850); _objSword.setStrip(3); _objSword.setFrame(1); - _objSword.setPosition(Common::Point(56, 101), 0); - _objSword.setPriority2(80); + _objSword.setPosition(Common::Point(56, 101)); + _objSword.fixPriority(80); _objSword.hide(); } @@ -1624,7 +1635,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _globals->_player.postInit(); _globals->_player.disableControl(); _sceneMode = 0; - setAction(&_sequenceManager, this, 9851, &_globals->_player, 0); + setAction(&_sequenceManager, this, 9851, &_globals->_player, NULL); } /*-------------------------------------------------------------------------- @@ -1632,38 +1643,38 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { * *--------------------------------------------------------------------------*/ void Scene9900::strAction1::signal() { - RGB8 mask1, mask2; - mask1.r = mask1.g = mask1.b = 0xff; - mask2.r = mask2.g = mask2.b = 0; + const byte mask1[3] = {0xff, 0xff, 0xff}; + const byte mask2[3] = {0, 0, 0}; Scene9900 *scene = (Scene9900 *)_globals->_sceneManager._scene; switch (_actionIndex++) { case 0: - scene->_soundHandler.startSound(351, 0, 127); + scene->_soundHandler.startSound(351); _object9.postInit(); _object9.setVisage(18); _object9._frame = 1; _object9._strip = 6; + _object9.fixPriority(250); _object9.setPosition(Common::Point(171, 59)); - _object9.animate(ANIM_MODE_5, 0); + _object9.animate(ANIM_MODE_5, NULL); _globals->_scenePalette.addRotation(67, 111, 1, 1, this); scene->_object2.hide(); break; case 1: _palette1.getPalette(); - _globals->_scenePalette.addUnkPal(&mask1, 1, true /*10*/, this); + _globals->_scenePalette.addFader(&mask1[0], 1, 10, this); break; case 2: _object9.remove(); - _globals->_scenePalette.addUnkPal(&mask2, 1, true /*5*/, this); + _globals->_scenePalette.addFader(&mask2[0], 1, 5, this); break; case 3: - _globals->_soundHandler.startSound(377, 0, 127); + _globals->_soundHandler.startSound(377); setDelay(120); break; case 4: - _globals->_scenePalette.addUnkPal(_palette1._palette, 256, 1, this); + _globals->_scenePalette.addFader(_palette1._palette, 256, 1, this); break; case 5: remove(); @@ -1676,57 +1687,58 @@ void Scene9900::strAction1::signal() { void Scene9900::strAction2::signal() { switch (_actionIndex++) { case 0: - var1 = 0; + _lineNum = 0; _txtArray1Index = 0; _txtArray1[0]._position.y = 200; - _txtArray1[0]._position.y = 300; + _txtArray1[1]._position.y = 300; _txtArray2[0]._position.y = 400; - _txtArray2[0]._position.y = 500; - var3 = 0; + _txtArray2[1]._position.y = 500; + _var3 = 0; // No break on purpose case 1: { - Common::String msg = _vm->_dataManager->getMessage(8030, var1++); - if (!msg.compareTo("LASTCREDIT")) { - if (var3 == 0) { + Common::String msg = _resourceManager->getMessage(8030, _lineNum++); + if (msg.compareTo("LASTCREDIT")) { + if (_var3) { // Not used? // int x = _txtArray1[_txtArray1Index].getFrame().getBounds().height(); _txtArray1[_txtArray1Index]._moveDiff.y = 10; NpcMover *mover = new NpcMover(); - Common::Point pt(_txtArray1[_txtArray1Index]._moveDiff.x, -100); - _txtArray1[_txtArray1Index].addMover(mover, &pt, 0); + Common::Point pt(_txtArray1[_txtArray1Index]._position.x, -100); + _txtArray1[_txtArray1Index].addMover(mover, &pt, NULL); // Not used? // int x = _txtArray2[_txtArray1Index].getFrame().getBounds().height(); _txtArray2[_txtArray1Index]._moveDiff.y = 10; _txtArray1Index = (_txtArray1Index + 1) % 2; } - var3 = 1; - _txtArray1[_txtArray1Index]._textMode = ALIGN_CENTRE; + _var3 = 1; + _txtArray1[_txtArray1Index]._textMode = ALIGN_CENTER; _txtArray1[_txtArray1Index]._width = 240; _txtArray1[_txtArray1Index]._fontNumber = 2; - _txtArray1[_txtArray1Index]._colour1 = 7; + _txtArray1[_txtArray1Index]._color1 = 7; _txtArray1[_txtArray1Index].setup(msg); - _txtArray1[_txtArray1Index]._field7A = 20; + _txtArray1[_txtArray1Index]._moveRate = 20; _txtArray1[_txtArray1Index]._moveDiff.y = 2; - _txtArray1[_txtArray1Index].setPriority2(255); + _txtArray1[_txtArray1Index].fixPriority(255); int frameWidth = _txtArray1[_txtArray1Index].getFrame().getBounds().width(); int frameHeight = _txtArray1[_txtArray1Index].getFrame().getBounds().height(); _txtArray1[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200)); + NpcMover *mover2 = new NpcMover(); Common::Point pt2(_txtArray1[_txtArray1Index]._position.x, 100); - _txtArray1[_txtArray1Index].addMover(mover2, &pt2, 0); + _txtArray1[_txtArray1Index].addMover(mover2, &pt2, this); - _txtArray2[_txtArray1Index]._textMode = ALIGN_CENTRE; + _txtArray2[_txtArray1Index]._textMode = ALIGN_CENTER; _txtArray2[_txtArray1Index]._width = 240; _txtArray2[_txtArray1Index]._fontNumber = 2; - _txtArray2[_txtArray1Index]._colour1 = 23; + _txtArray2[_txtArray1Index]._color1 = 23; - msg = _vm->_dataManager->getMessage(8030, var1++); + msg = _resourceManager->getMessage(8030, _lineNum++); _txtArray2[_txtArray1Index].setup(msg); - _txtArray2[_txtArray1Index]._field7A = 20; + _txtArray2[_txtArray1Index]._moveRate = 20; _txtArray2[_txtArray1Index]._moveDiff.y = 2; - _txtArray2[_txtArray1Index].setPriority2(255); + _txtArray2[_txtArray1Index].fixPriority(255); frameWidth = _txtArray2[_txtArray1Index].getFrame().getBounds().width(); _txtArray2[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200 + frameHeight)); } else { @@ -1769,29 +1781,28 @@ void Scene9900::strAction2::dispatch() { } void Scene9900::strAction3::signal() { - RGB8 mask3, mask4; - mask3.r = 0xff; mask3.g = mask3.b = 0; - mask4.r = mask4.g = mask4.b = 0; + const byte mask3[3] = {0xff, 0, 0}; + const byte mask4[3] = {0, 0, 0}; switch (_actionIndex++) { case 0: _palette2.getPalette(); _palette3.loadPalette(2003); - _globals->_scenePalette.addUnkPal(_palette3._palette, 256, true /*5*/, this); + _globals->_scenePalette.addFader(_palette3._palette, 256, 5, this); break; case 1: - _globals->_scenePalette.addUnkPal(&mask3, 1, true /*10*/, this); + _globals->_scenePalette.addFader(&mask3[0], 1, 10, this); break; case 2: - _globals->_scenePalette.addUnkPal(&mask4, 1, true /*1*/, this); + _globals->_scenePalette.addFader(&mask4[0], 1, 1, this); break; case 3: _palette2.loadPalette(17); _globals->_sceneManager._scene->loadScene(17); - _globals->_scenePalette.addUnkPal(_palette2._palette, 256, true /*5*/, this); + _globals->_scenePalette.addFader(_palette2._palette, 256, 5, this); break; case 4: - _globals->_game.endGame(9900, 61); + _globals->_game->endGame(9900, 61); remove(); default: break; @@ -1808,35 +1819,35 @@ void Scene9900::signal() { _object6.hide(); } - _object1.animate(ANIM_MODE_NONE, 0); - _object2.animate(ANIM_MODE_NONE, 0); - _object3.animate(ANIM_MODE_NONE, 0); - _object4.animate(ANIM_MODE_NONE, 0); - _object5.animate(ANIM_MODE_NONE, 0); - _object6.animate(ANIM_MODE_NONE, 0); + _object1.animate(ANIM_MODE_NONE, NULL); + _object2.animate(ANIM_MODE_NONE, NULL); + _object3.animate(ANIM_MODE_NONE, NULL); + _object4.animate(ANIM_MODE_NONE, NULL); + _object5.animate(ANIM_MODE_NONE, NULL); + _object6.animate(ANIM_MODE_NONE, NULL); - _object1.setObjectWrapper(0); - _object2.setObjectWrapper(0); - _object3.setObjectWrapper(0); - _object4.setObjectWrapper(0); - _object5.setObjectWrapper(0); - _object6.setObjectWrapper(0); + _object1.setObjectWrapper(NULL); + _object2.setObjectWrapper(NULL); + _object3.setObjectWrapper(NULL); + _object4.setObjectWrapper(NULL); + _object5.setObjectWrapper(NULL); + _object6.setObjectWrapper(NULL); - _object1.addMover(0); - _object2.addMover(0); - _object3.addMover(0); - _object4.addMover(0); - _object5.addMover(0); - _object6.addMover(0); + _object1.addMover(NULL); + _object2.addMover(NULL); + _object3.addMover(NULL); + _object4.addMover(NULL); + _object5.addMover(NULL); + _object6.addMover(NULL); switch (_sceneMode){ case 150: - _globals->_soundHandler.startSound(380, 0, 127); - _object8.postInit(0); + _globals->_soundHandler.startSound(380); + _object8.postInit(); _object8.setVisage(2002); _object8.setStrip(1); _object8.setFrame(1); - _object8.setPriority2(200); + _object8.fixPriority(200); _object8.setPosition(Common::Point(64, 199)); _globals->_player.disableControl(); _sceneMode = 9908; @@ -1844,7 +1855,7 @@ void Scene9900::signal() { break; case 162: warning("TBC: shutdown();"); - _globals->_game.quitGame(); + _globals->_game->quitGame(); break; case 9901: _globals->_player.disableControl(); @@ -1864,7 +1875,7 @@ void Scene9900::signal() { setAction(&_sequenceManager, this, 9902, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); break; case 9904: - _globals->_soundHandler.startSound(390, 0, 127); + _globals->_soundHandler.startSound(390); _sceneMode = 9912; setAction(&_strAction2, this); break; @@ -1895,7 +1906,7 @@ void Scene9900::signal() { setAction(&_sequenceManager, this, 9904, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); break; case 9909: - _globals->_soundHandler.startSound(375, 0, 127); + _globals->_soundHandler.startSound(375); _globals->_player.disableControl(); _sceneMode = 9907; setAction(&_sequenceManager, this, 9907, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); @@ -1906,7 +1917,7 @@ void Scene9900::signal() { setAction(&_sequenceManager, this, 9911, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); break; case 9911: - _globals->_soundHandler.startSound(367, 0, 127); + _globals->_soundHandler.startSound(367); _globals->_player.disableControl(); _sceneMode = 9909; setAction(&_sequenceManager, this, 9909, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); @@ -1932,10 +1943,10 @@ void Scene9900::process(Event &event) { if (event.handled) return; Scene::process(event); - if (_sceneMode != 9906) { + if (_sceneMode == 9906) { if ((event.eventType == EVENT_BUTTON_DOWN) && (_globals->_events.getCursor() == OBJECT_ITEMS)) { _object8._state = 1; - _globals->_inventory._items._sceneNumber = 9900; + RING_INVENTORY._items._sceneNumber = 9900; _globals->_events.setCursor(CURSOR_USE); } } @@ -1947,25 +1958,25 @@ void Scene9900::dispatch() { } void Scene9900::postInit(SceneObjectList *OwnerList) { - _object1.postInit(0); + _object1.postInit(); _object1.hide(); - _object2.postInit(0); + _object2.postInit(); _object2.hide(); - _object3.postInit(0); + _object3.postInit(); _object3.hide(); - _object4.postInit(0); + _object4.postInit(); _object4.hide(); - _object5.postInit(0); + _object5.postInit(); _object5.hide(); - _object6.postInit(0); + _object6.postInit(); _object6.hide(); _object8._state = 0; - _globals->_inventory._concentrator._sceneNumber = 9900; - _globals->_inventory._items._rlbNum = 3; - _globals->_inventory._items._cursorNum = 6; - _globals->_inventory._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge."); + RING_INVENTORY._concentrator._sceneNumber = 9900; + RING_INVENTORY._items._rlbNum = 3; + RING_INVENTORY._items._cursorNum = 6; + RING_INVENTORY._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge."); _stripManager.addSpeaker(&_speakerMR); _globals->_player.disableControl(); @@ -1999,7 +2010,7 @@ void Scene9999::Action2::signal() { setDelay(10); break; case 1: - SceneItem::display(9999, 0, SET_Y, 10, SET_X, 30, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 23, SET_WIDTH, 260, SET_KEEP_ONSCREEN, 1, LIST_END); + SceneItem::display(9999, 0, SET_Y, 10, SET_X, 30, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 23, SET_WIDTH, 260, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(300); break; case 2: @@ -2018,29 +2029,29 @@ void Scene9999::postInit(SceneObjectList *OwnerList) { _object1.postInit(); _object1.setVisage(1303); _object1.setStrip2(3); - _object1.setPosition(Common::Point(160, 152), 0); + _object1.setPosition(Common::Point(160, 152)); _globals->_player.postInit(); _globals->_player.setVisage(1303); _globals->_player.setStrip2(1); - _globals->_player.setPriority2(250); - _globals->_player.animate(ANIM_MODE_2, 0); - _globals->_player.setPosition(Common::Point(194, 98), 0); + _globals->_player.fixPriority(250); + _globals->_player.animate(ANIM_MODE_2, NULL); + _globals->_player.setPosition(Common::Point(194, 98)); _globals->_player._numFrames = 20; _globals->_player.disableControl(); _object2.postInit(); _object2.setVisage(1303); _object2.setStrip2(2); - _object2.setPriority2(2); - _object2.setPosition(Common::Point(164, 149), 0); + _object2.fixPriority(2); + _object2.setPosition(Common::Point(164, 149)); _object3.postInit(); _object3.setVisage(1303); _object3.setStrip2(2); - _object3.setPriority2(2); + _object3.fixPriority(2); _object3.setFrame(2); - _object3.setPosition(Common::Point(292, 149), 0); + _object3.setPosition(Common::Point(292, 149)); _object3.setAction(&_action3); if (_globals->_sceneManager._previousScene == 3500) @@ -2048,7 +2059,7 @@ void Scene9999::postInit(SceneObjectList *OwnerList) { else setAction(&_action1); - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; @@ -2057,7 +2068,7 @@ void Scene9999::postInit(SceneObjectList *OwnerList) { else _globals->_stripNum = 2121; - _globals->_soundHandler.startSound(118, 0, 127); + _globals->_soundHandler.startSound(118); } diff --git a/engines/tsage/ringworld_scenes10.h b/engines/tsage/ringworld_scenes10.h index a89456e39d..93987aa64b 100644 --- a/engines/tsage/ringworld_scenes10.h +++ b/engines/tsage/ringworld_scenes10.h @@ -39,8 +39,8 @@ class SceneObject9150 : public SceneObject { public: int _timer, _signalFlag; - virtual void synchronise(Serialiser &s) { - SceneObject::synchronise(s); + virtual void synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsSint16LE(_timer); s.syncAsSint16LE(_signalFlag); } @@ -52,8 +52,8 @@ public : int _sceneState; Scene2(); - virtual void synchronise(Serialiser &s) { - Scene::synchronise(s); + virtual void synchronize(Serializer &s) { + Scene::synchronize(s); s.syncAsSint16LE(_sceneState); } }; @@ -467,7 +467,7 @@ class Scene9900 : public Scene { public: SceneText _txtArray1[2]; SceneText _txtArray2[2]; - int var1, _txtArray1Index, var3; + int _lineNum, _txtArray1Index, _var3; virtual void signal(); virtual void dispatch(); @@ -482,17 +482,6 @@ class Scene9900 : public Scene { virtual void signal(); }; - class SceneTextArr1 { - public: - SceneText _sceneText[2]; - }; - - class SceneTextArr2 { - public: - SceneText _sceneText[2]; - int _var1, var2, var3; - }; - public: SoundHandler _soundHandler; SequenceManager _sequenceManager; diff --git a/engines/tsage/ringworld_scenes2.cpp b/engines/tsage/ringworld_scenes2.cpp index 8d95460615..6a8db81adf 100644 --- a/engines/tsage/ringworld_scenes2.cpp +++ b/engines/tsage/ringworld_scenes2.cpp @@ -23,6 +23,7 @@ * */ +#include "common/config-manager.h" #include "tsage/ringworld_scenes2.h" #include "tsage/scenes.h" #include "tsage/tsage.h" @@ -76,8 +77,8 @@ void Scene1000::Action2::signal() { setDelay(10); break; case 1: - SceneItem::display(1000, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1, - SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END); + SceneItem::display(1000, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1, + SET_EXT_BGCOLOR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(180); break; case 2: @@ -112,28 +113,25 @@ void Scene1000::Action3::signal() { setDelay(240); break; case 5: { - // Intro.txt file presence is used to allow user option to skip the introduction - _globals->_player.enableControl(); - Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading("Intro.txt"); - if (!in) { - // File not present, so create it - Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving("Intro.txt"); - out->finalize(); - delete out; + const char *SEEN_INTRO = "seen_intro"; + if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) { + // First time being played, so show the introduction + ConfMan.setBool(SEEN_INTRO, true); + ConfMan.flushToDisk(); setDelay(1); } else { - delete in; - // Prompt user for whether to start play or watch introduction + _globals->_player.enableControl(); + if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) { _actionIndex = 20; _globals->_soundHandler.proc1(this); } else { setDelay(1); } - - _globals->_player.disableControl(); } + + _globals->_player.disableControl(); break; } case 6: { @@ -266,7 +264,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) { setAction(&_action2); - _globals->_sceneManager._scene->_sceneBounds.centre(_object1._position.x, _object1._position.y); + _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; @@ -280,7 +278,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) { _object1._moveDiff = Common::Point(2, 2); _object1.setPosition(Common::Point(120, 180)); - _globals->_sceneManager._scene->_sceneBounds.centre(_object1._position.x, _object1._position.y); + _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; @@ -301,7 +299,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) { _globals->_player.hide(); _globals->_player.disableControl(); - _globals->_sceneManager._scene->_sceneBounds.centre(_object3._position.x, _object3._position.y); + _globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y); setAction(&_action3); } @@ -439,7 +437,7 @@ void Scene1001::Action1::signal() { scene->_object6.setStrip2(6); scene->_object6.setFrame2(2); scene->_object6._moveDiff = Common::Point(20, 20); - scene->_object6.setPriority2(20); + scene->_object6.fixPriority(20); scene->_object6.setPosition(Common::Point(scene->_object2._position.x - 6, scene->_object2._position.y + 7)); scene->_object6.animate(ANIM_MODE_5, NULL); @@ -458,7 +456,7 @@ void Scene1001::Action1::signal() { scene->_object7.setFrame2(1); scene->_object7._moveDiff = Common::Point(20, 20); scene->_object7.setPosition(Common::Point(scene->_object3._position.x - 28, scene->_object3._position.y - 11)); - scene->_object7.setPriority2(200); + scene->_object7.fixPriority(200); scene->_object7.animate(ANIM_MODE_5, NULL); Common::Point pt(scene->_object7._position.x - 70, scene->_object7._position.y - 70); @@ -473,7 +471,7 @@ void Scene1001::Action1::signal() { scene->_object5.setVisage(16); scene->_object5.setPosition(Common::Point(306, 93)); scene->_object5._strip = 3; - scene->_object5.setPriority2(200); + scene->_object5.fixPriority(200); scene->_object5.animate(ANIM_MODE_2, NULL); setDelay(30); break; @@ -521,7 +519,7 @@ void Scene1001::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerCText); _stripManager.addSpeaker(&_speakerCR); _stripManager.addSpeaker(&_speakerSL); - _speakerQText._colour1 = 11; + _speakerQText._color1 = 11; _object3.postInit(); _object3.setVisage(16); @@ -638,7 +636,7 @@ void Scene1250::postInit(SceneObjectList *OwnerList) { _object2.setVisage(1250); _object2.setPosition(Common::Point(126, 69)); _object2.setStrip2(2); - _object2.setPriority2(255); + _object2.fixPriority(255); _object2._frame = 1; _object2.setAction(&_action2); @@ -666,7 +664,7 @@ void Scene1400::Action1::signal() { setDelay(5); break; case 1: { - SceneItem::display(1400, 0, SET_X, 120, SET_Y, 610, SET_FONT, 2, SET_EXT_BGCOLOUR, 23, SET_KEEP_ONSCREEN, -1, LIST_END); + SceneItem::display(1400, 0, SET_X, 120, SET_Y, 610, SET_FONT, 2, SET_EXT_BGCOLOR, 23, SET_KEEP_ONSCREEN, -1, LIST_END); Common::Point pt(160, 700); NpcMover *mover = new NpcMover(); @@ -687,7 +685,7 @@ void Scene1400::Action1::signal() { } case 3: SceneItem::display(1400, 2, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80, - SET_FONT, 2, SET_FG_COLOUR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); + SET_FONT, 2, SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); setDelay(420); break; case 4: @@ -696,7 +694,7 @@ void Scene1400::Action1::signal() { break; case 5: SceneItem::display(1400, 3, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80, - SET_FONT, 2, SET_FG_COLOUR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); + SET_FONT, 2, SET_FG_COLOR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); setDelay(360); break; case 6: @@ -722,7 +720,7 @@ void Scene1400::Action1::signal() { _globals->_player.animate(ANIM_MODE_2, NULL); SceneItem::display(1400, 4, SET_X, 30, SET_Y, _globals->_player._position.y + 10, SET_FONT, 2, - SET_FG_COLOUR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); + SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END); setDelay(300); break; case 9: { @@ -771,12 +769,12 @@ void Scene1400::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(1401); _globals->_player.animate(ANIM_MODE_2, 0); _globals->_player.setStrip2(4); - _globals->_player.setPriority2(4); + _globals->_player.fixPriority(4); _globals->_player.disableControl(); _globals->_player._moveDiff = Common::Point(4, 2); _globals->_player.setPosition(Common::Point(160, 800)); - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.y = (_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100; @@ -874,7 +872,7 @@ void Scene1500::Action2::signal() { case 1: { scene->_object2.postInit(); scene->_object2.setVisage(1502); - scene->_object2.setPriority2(255); + scene->_object2.fixPriority(255); scene->_object2.changeZoom(5); scene->_object2._frame = 1; scene->_object2._moveDiff = Common::Point(1, 1); @@ -897,7 +895,7 @@ void Scene1500::Action2::signal() { case 3: scene->_soundHandler.proc4(); _globals->_stripNum = 1505; - _globals->_sceneManager.changeScene(1505); + _globals->_sceneManager.changeScene(2400); break; } } diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp index b37b156907..f788f9a28b 100644 --- a/engines/tsage/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld_scenes3.cpp @@ -226,8 +226,8 @@ void Scene2000::Action10::signal() { error("Old stuff"); break; case 2: - SceneItem::display(2000, 17, SET_Y, 20, SET_X, 110, SET_FONT, 2, SET_BG_COLOUR, -1, - SET_FG_COLOUR, 17, SET_WIDTH, 200, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, 1, LIST_END); + SceneItem::display(2000, 17, SET_Y, 20, SET_X, 110, SET_FONT, 2, SET_BG_COLOR, -1, + SET_FG_COLOR, 17, SET_WIDTH, 200, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, 1, LIST_END); break; case 3: SceneItem::display(0, 0); @@ -405,7 +405,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { _object9.setStrip2(3); _object9.setFrame(4); _object9.setPosition(Common::Point(136, 86)); - _object9.setPriority2(190); + _object9.fixPriority(190); _object9.hide(); _object10.postInit(); @@ -413,7 +413,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { _object10.setStrip2(5); _object10.setFrame(4); _object10.setPosition(Common::Point(202, 86)); - _object10.setPriority2(195); + _object10.fixPriority(195); _object10.hide(); switch (_globals->_sceneManager._previousScene) { @@ -519,7 +519,7 @@ void Scene2100::Action1::signal() { setDelay(3); break; case 5: - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); scene->_area1.display(); scene->_area2.display(); scene->_area3.display(); @@ -578,7 +578,7 @@ void Scene2100::Action1::signal() { } break; case 7: - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); scene->_soundHandler.startSound(162); scene->_object1.animate(ANIM_MODE_6, this); break; @@ -684,6 +684,7 @@ void Scene2100::Action5::signal() { } void Scene2100::Action6::signal() { + // Seeker stands up and walks to the elevator Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -699,14 +700,14 @@ void Scene2100::Action6::signal() { Common::Point pt(130, 116); NpcMover *mover = new NpcMover(); - scene->_object2.addMover(mover, &pt, NULL); + scene->_object2.addMover(mover, &pt, this); break; } case 1: { - scene->_object2.setPriority2(-1); + scene->_object2.fixPriority(-1); Common::Point pt(153, 67); NpcMover *mover = new NpcMover(); - scene->_object2.addMover(mover, &pt, NULL); + scene->_object2.addMover(mover, &pt, this); break; } case 2: @@ -752,10 +753,10 @@ void Scene2100::Action8::signal() { } case 3: _globals->_player.checkAngle(&scene->_object3); - scene->_stripManager.start((_globals->_inventory._translator._sceneNumber == 1) ? 7720 : 7710, this); + scene->_stripManager.start((RING_INVENTORY._translator._sceneNumber == 1) ? 7720 : 7710, this); break; case 4: - if (_globals->_inventory._translator._sceneNumber != 1) + if (RING_INVENTORY._translator._sceneNumber != 1) _globals->_sceneManager.changeScene(7600); else { _globals->setFlag(24); @@ -835,7 +836,7 @@ void Scene2100::Action10::signal() { scene->_object3.setVisage(2705); scene->_object3.setStrip2(-1); scene->_object3.changeZoom(-1); - scene->_object3.setPriority2(-1); + scene->_object3.fixPriority(-1); scene->_object3.setPosition(Common::Point(260, 156)); scene->_object3.setObjectWrapper(new SceneObjectWrapper()); scene->_object3.animate(ANIM_MODE_1, NULL); @@ -852,30 +853,30 @@ void Scene2100::Action10::signal() { scene->_object1.animate(ANIM_MODE_5, this); break; case 6: { - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); Common::Point pt(144, 54); NpcMover *mover = new NpcMover(); _globals->_player.addMover(mover, &pt, this); break; } case 7: { - scene->_object3.setPriority2(2); + scene->_object3.fixPriority(2); Common::Point pt1(163, 55); NpcMover *mover1 = new NpcMover(); scene->_object3.addMover(mover1, &pt1, NULL); - scene->_object2.setPriority2(2); + scene->_object2.fixPriority(2); Common::Point pt2(158, 55); NpcMover *mover2 = new NpcMover(); scene->_object2.addMover(mover2, &pt2, this); break; } case 8: - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setStrip(1); - scene->_object3.setPriority2(1); + scene->_object3.fixPriority(1); scene->_object3.setStrip(2); - scene->_object2.setPriority2(2); + scene->_object2.fixPriority(2); scene->_object2.setStrip(3); setDelay(45); @@ -893,6 +894,7 @@ void Scene2100::Action10::signal() { } void Scene2100::Action11::signal() { + // Miranda stands up and walks to the elevator Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -911,7 +913,7 @@ void Scene2100::Action11::signal() { scene->_object3.setVisage(2705); scene->_object3.setStrip2(-1); scene->_object3.changeZoom(-1); - scene->_object3.setPriority2(-1); + scene->_object3.fixPriority(-1); scene->_object3.setPosition(Common::Point(260, 156)); scene->_object3.setObjectWrapper(new SceneObjectWrapper()); scene->_object3.animate(ANIM_MODE_1, NULL); @@ -928,12 +930,12 @@ void Scene2100::Action11::signal() { scene->_object1.animate(ANIM_MODE_5, this); break; case 4: { - scene->_object3.setPriority2(1); + scene->_object3.fixPriority(1); Common::Point pt1(163, 55); NpcMover *mover1 = new NpcMover(); scene->_object3.addMover(mover1, &pt1, NULL); - scene->_object2.setPriority2(1); + scene->_object2.fixPriority(1); Common::Point pt2(158, 55); NpcMover *mover2 = new NpcMover(); scene->_object2.addMover(mover2, &pt2, this); @@ -987,12 +989,12 @@ void Scene2100::Action12::signal() { scene->_soundHandler.startSound(162); scene->_object1.animate(ANIM_MODE_6, NULL); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); Common::Point pt1(277, 84); PlayerMover *mover1 = new PlayerMover(); _globals->_player.addMover(mover1, &pt1, this); - scene->_object2.setPriority2(-1); + scene->_object2.fixPriority(-1); Common::Point pt2(255, 76); PlayerMover *mover2 = new PlayerMover(); scene->_object2.addMover(mover2, &pt2, this); @@ -1020,6 +1022,8 @@ void Scene2100::Action12::signal() { case 10: if (_globals->getFlag(74)) setDelay(1); + else + setAction(&scene->_sequenceManager, this, 2101, &_globals->_player, NULL); break; case 11: scene->_stripManager.start(2170, this); @@ -1050,7 +1054,7 @@ void Scene2100::Action13::signal() { setDelay(6); break; case 1: { - scene->_object2.setPriority2(113); + scene->_object2.fixPriority(113); Common::Point pt(178, 116); PlayerMover *mover = new PlayerMover(); scene->_object2.addMover(mover, &pt, this); @@ -1123,7 +1127,7 @@ void Scene2100::Action14::signal() { scene->_object3.setVisage(2705); scene->_object3.setStrip2(-1); scene->_object3.changeZoom(-1); - scene->_object3.setPriority2(-1); + scene->_object3.fixPriority(-1); scene->_object3.setPosition(Common::Point(260, 156)); scene->_object3.setObjectWrapper(new SceneObjectWrapper()); scene->_object3.animate(ANIM_MODE_1, NULL); @@ -1147,7 +1151,7 @@ void Scene2100::Action14::signal() { scene->_object3.setStrip(2); setDelay(30); case 13: - scene->_object3.setPriority2(1); + scene->_object3.fixPriority(1); scene->_soundHandler.startSound(162); scene->_object1.animate(ANIM_MODE_6, this); break; @@ -1174,14 +1178,14 @@ void Scene2100::Action15::signal() { scene->_object3.animate(ANIM_MODE_1, NULL); scene->_object3.setObjectWrapper(new SceneObjectWrapper()); scene->_object3.setPosition(Common::Point(157, 56)); - scene->_object3.setPriority2(1); + scene->_object3.fixPriority(1); scene->_object3.changeZoom(-1); scene->_soundHandler.startSound(162); scene->_object1.animate(ANIM_MODE_5, this); break; case 2: { - scene->_object3.setPriority2(-1); + scene->_object3.fixPriority(-1); Common::Point pt(177, 68); NpcMover *mover = new NpcMover(); scene->_object3.addMover(mover, &pt, this); @@ -1203,7 +1207,7 @@ void Scene2100::Action15::signal() { break; } case 5: { - scene->_object3.setPriority2(156); + scene->_object3.fixPriority(156); Common::Point pt(260, 156); NpcMover *mover = new NpcMover(); @@ -1258,7 +1262,7 @@ void Scene2100::Action16::signal() { break; } case 7: - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setStrip(3); setDelay(45); break; @@ -1311,7 +1315,7 @@ void Scene2100::Action17::signal() { scene->_stripManager.start(7072, this); break; case 8: - _globals->_inventory._stasisNegator._sceneNumber = 1; + RING_INVENTORY._stasisNegator._sceneNumber = 1; _globals->_sceneManager.changeScene(9100); remove(); break; @@ -1342,6 +1346,7 @@ void Scene2100::Hotspot2::doAction(int action) { } void Scene2100::Hotspot3::doAction(int action) { + // Computer, on the left Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (action) { @@ -1442,6 +1447,7 @@ void Scene2100::Hotspot14::doAction(int action) { } void Scene2100::Object1::doAction(int action) { + // Elevator Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene; switch (action) { @@ -1555,7 +1561,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object1.setVisage(2100); _object1.animate(ANIM_MODE_NONE, NULL); _object1.setPosition(Common::Point(157, 57)); - _object1.setPriority(5); + _object1.fixPriority(5); _hotspot3.postInit(); _hotspot3.setVisage(2101); @@ -1563,7 +1569,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _hotspot3.animate(ANIM_MODE_2, NULL); _hotspot3.setPosition(Common::Point(53, 44)); _hotspot3.changeZoom(100); - _hotspot3.setPriority2(1); + _hotspot3.fixPriority(1); _hotspot4.postInit(); _hotspot4.setVisage(2101); @@ -1572,7 +1578,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _hotspot4.animate(ANIM_MODE_8, 0, NULL); _hotspot4.setPosition(Common::Point(274, 52)); _hotspot4.changeZoom(100); - _hotspot4.setPriority2(1); + _hotspot4.fixPriority(1); _hotspot5.postInit(); _hotspot5.setVisage(2101); @@ -1581,13 +1587,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _hotspot5.animate(ANIM_MODE_8, 0, NULL); _hotspot5.setPosition(Common::Point(219, 141)); _hotspot5.changeZoom(100); - _hotspot5.setPriority2(160); + _hotspot5.fixPriority(160); _hotspot6.postInit(); _hotspot6.setVisage(2101); _hotspot6._frame = 1; _hotspot6._strip = 5; - _hotspot6.setPriority2(175); + _hotspot6.fixPriority(175); _hotspot6.animate(ANIM_MODE_8, 0, NULL); _hotspot6.setPosition(Common::Point(97, 142)); _hotspot6.changeZoom(100); @@ -1599,7 +1605,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _hotspot7.animate(ANIM_MODE_NONE, NULL); _hotspot7.setPosition(Common::Point(133, 46)); _hotspot7.changeZoom(100); - _hotspot7.setPriority2(1); + _hotspot7.fixPriority(1); _hotspot8.postInit(); _hotspot8.setVisage(2101); @@ -1608,16 +1614,16 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _hotspot8.animate(ANIM_MODE_8, 0, NULL); _hotspot8.setPosition(Common::Point(20, 45)); _hotspot8.changeZoom(100); - _hotspot8.setPriority2(1); + _hotspot8.fixPriority(1); _hotspot2.postInit(); _hotspot2.setVisage(2101); _hotspot2._frame = 1; - _hotspot2._strip = 7; + _hotspot2._strip = 8; _hotspot2.animate(ANIM_MODE_8, 0, NULL); _hotspot2.setPosition(Common::Point(88, 41)); _hotspot2.changeZoom(100); - _hotspot2.setPriority2(1); + _hotspot2.fixPriority(1); _hotspot11.setBounds(Rect(139, 74, 173, 96)); _hotspot10.setBounds(Rect(71, 100, 91, 135)); @@ -1633,7 +1639,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object3.setPosition(Common::Point(246, 156)); _object3.animate(ANIM_MODE_NONE, NULL); _object3.changeZoom(100); - _object3.setPriority2(156); + _object3.fixPriority(156); _object3.setVisage(2107); _object3.setStrip(1); _object3.setAction(&_action2); @@ -1647,7 +1653,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object2.setPosition(Common::Point(150, 100)); _object2.animate(ANIM_MODE_NONE, NULL); _object2.changeZoom(100); - _object2.setPriority2(113); + _object2.fixPriority(113); _object2.setAction(&_action3); _globals->_sceneItems.push_back(&_object2); } @@ -1666,7 +1672,14 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _area4._pt = Common::Point(237, 77); _globals->_player.postInit(); - _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0); + if (_globals->getFlag(13)) { + _globals->_player.setVisage(2170); + _globals->_player._moveDiff.y = 1; + } else { + _globals->_player.setVisage(0); + _globals->_player._moveDiff.y = 3; + } + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player._moveDiff.x = 4; @@ -1678,13 +1691,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { case 2120: _globals->_soundHandler.startSound(160); _globals->_soundHandler.proc5(true); - _object1.setPriority2(-1); - _globals->_player.setPriority2(-1); + _object1.fixPriority(-1); + _globals->_player.fixPriority(-1); _globals->_player.setPosition(Common::Point(80, 66)); _globals->_player.enableControl(); break; case 2150: - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(157, 56)); _sceneMode = 2104; setAction(&_sequenceManager, this, 2104, &_globals->_player, &_object1, NULL); @@ -1693,13 +1706,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneObjects->contains(&_object3)) _object3.remove(); - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(144, 55)); _object2.setVisage(2806); _object2.changeZoom(-1); _object2.setPosition(Common::Point(158, 55)); - _object2.setPriority2(1); + _object2.fixPriority(1); _object2.setAction(NULL); _object2.setObjectWrapper(new SceneObjectWrapper()); _object2.animate(ANIM_MODE_1, NULL); @@ -1711,7 +1724,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneObjects->contains(&_object3)) _object3.remove(); - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(144, 55)); _object2.postInit(); @@ -1719,7 +1732,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object2.setStrip(1); _object2.changeZoom(-1); _object2.setPosition(Common::Point(158, 55)); - _object2.setPriority2(1); + _object2.fixPriority(1); _object2.setAction(NULL); _object2.setObjectWrapper(new SceneObjectWrapper()); _object2.animate(ANIM_MODE_1, NULL); @@ -1727,7 +1740,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { setAction(&_action12); } else if (_globals->_stripNum == 6100) { _globals->_player.setPosition(Common::Point(157, 56)); - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _object4.postInit(); _object4.setVisage(2102); @@ -1754,11 +1767,11 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player._angle = 225; _globals->_player.setStrip(6); _globals->_player.setFrame(1); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.setPosition(Common::Point(272, 127)); _object3.setPosition(Common::Point(246, 156)); - _object3.setPriority2(156); + _object3.fixPriority(156); _sceneMode = 2105; setAction(&_sequenceManager, this, 2105, &_object3, NULL); break; @@ -1770,7 +1783,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2104); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(65, 149)); - _globals->_player.setPriority2(152); + _globals->_player.fixPriority(152); _globals->_player.setStrip(2); _object4.postInit(); @@ -1790,11 +1803,11 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setStrip(3); _globals->_player.setFrame(1); - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(157, 56)); _object3.setPosition(Common::Point(246, 156)); - _object3.setPriority2(156); + _object3.fixPriority(156); setAction(&_action5); break; @@ -1804,7 +1817,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2104); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(65, 149)); - _globals->_player.setPriority2(152); + _globals->_player.fixPriority(152); _globals->_player.setStrip(2); _field1800 = 1; @@ -1814,15 +1827,15 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _object4.setPosition(Common::Point(160, 199)); _object4.hide(); - _globals->_inventory._stasisBox._sceneNumber = 0; + RING_INVENTORY._stasisBox._sceneNumber = 0; setAction(&_action9); break; case 7000: _globals->_soundHandler.startSound(160); _globals->_soundHandler.proc5(true); - if (_globals->_inventory._stasisBox2._sceneNumber == 1) { - _globals->_player.setPriority2(1); + if (RING_INVENTORY._stasisBox2._sceneNumber == 1) { + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(157, 56)); _object4.postInit(); @@ -1838,7 +1851,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2104); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(65, 149)); - _globals->_player.setPriority2(152); + _globals->_player.fixPriority(152); _globals->_player.setStrip(2); _field1800 = 1; @@ -1852,7 +1865,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { if (_globals->_sceneObjects->contains(&_object2)) _object2.remove(); - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); _globals->_player.setPosition(Common::Point(157, 56)); setAction(&_action8); @@ -1864,7 +1877,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2104); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(65, 149)); - _globals->_player.setPriority2(152); + _globals->_player.fixPriority(152); _globals->_player.setStrip(2); _sceneMode = 2106; @@ -1877,7 +1890,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2104); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(65, 149)); - _globals->_player.setPriority2(152); + _globals->_player.fixPriority(152); _globals->_player.setStrip(2); _object4.postInit(); @@ -1995,12 +2008,12 @@ void Scene2120::Action1::signal() { break; case 1: // First page of index - SceneItem::display(2120, 0, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1, + SceneItem::display(2120, 0, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1, SET_WIDTH, 200, SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END); break; case 2: // Second page of index - SceneItem::display(2120, 1, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1, + SceneItem::display(2120, 1, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1, SET_WIDTH, 200, SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END); break; case 3: @@ -2016,7 +2029,7 @@ void Scene2120::Action1::signal() { case 4: // Display page of text SceneItem::display(2121, _entries[scene->_subjectIndex]._lineNum + scene->_lineOffset, - SET_X, 130, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1, SET_WIDTH, 200, + SET_X, 130, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1, SET_WIDTH, 200, SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END); _actionIndex = 4; break; @@ -2182,8 +2195,8 @@ void Scene2120::postInit(SceneObjectList *OwnerList) { _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; } -void Scene2120::synchronise(Serialiser &s) { - Scene::synchronise(s); +void Scene2120::synchronize(Serializer &s) { + Scene::synchronize(s); s.syncAsSint16LE(_dbMode); s.syncAsSint16LE(_prevDbMode); @@ -2318,7 +2331,7 @@ void Scene2150::Action2::signal() { break; case 3: _globals->_events.setCursor(CURSOR_WALK); - scene->_stripManager.start((_globals->_inventory._ale._sceneNumber == 2150) ? 2151 : 2152, this); + scene->_stripManager.start((RING_INVENTORY._ale._sceneNumber == 2150) ? 2151 : 2152, this); break; case 4: scene->_hotspot14.postInit(); @@ -2328,7 +2341,7 @@ void Scene2150::Action2::signal() { if (scene->_stripManager._field2E8 == 15) { scene->_hotspot14.setFrame(5); - _globals->_inventory._ale._sceneNumber = 1; + RING_INVENTORY._ale._sceneNumber = 1; } else { scene->_hotspot14.setFrame(scene->_stripManager._field2E8 - 5); } @@ -2474,7 +2487,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot7.animate(ANIM_MODE_8, NULL); _hotspot7.setPosition(Common::Point(122, 62)); _hotspot7.changeZoom(100); - _hotspot7.setPriority2(76); + _hotspot7.fixPriority(76); _hotspot2.postInit(); _hotspot2.setVisage(2151); @@ -2483,7 +2496,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot2.animate(ANIM_MODE_NONE, NULL); _hotspot2.setPosition(Common::Point(257, 67)); _hotspot2.changeZoom(100); - _hotspot2.setPriority2(60); + _hotspot2.fixPriority(60); _hotspot1.postInit(); _hotspot1.setVisage(2151); @@ -2492,7 +2505,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot1.animate(ANIM_MODE_NONE, NULL); _hotspot1.setPosition(Common::Point(158, 99)); _hotspot1.changeZoom(100); - _hotspot1.setPriority2(99); + _hotspot1.fixPriority(99); _hotspot4.postInit(); _hotspot4.setVisage(2150); @@ -2501,7 +2514,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _hotspot4.animate(ANIM_MODE_NONE, NULL); _hotspot4.setPosition(Common::Point(218, 200)); _hotspot4.changeZoom(100); - _hotspot4.setPriority2(200); + _hotspot4.fixPriority(200); _hotspot10.postInit(); _hotspot10.setVisage(2152); @@ -2515,7 +2528,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0); _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.setObjectWrapper(new SceneObjectWrapper()); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.changeZoom(-1); _globals->_player._moveDiff.y = 3; @@ -2576,10 +2589,10 @@ void Scene2150::postInit(SceneObjectList *OwnerList) { _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; } -void Scene2150::synchronise(Serialiser &s) { - Scene::synchronise(s); - _rect1.synchronise(s); - _rect2.synchronise(s); +void Scene2150::synchronize(Serializer &s) { + Scene::synchronize(s); + _rect1.synchronize(s); + _rect2.synchronize(s); } void Scene2150::signal() { @@ -2714,7 +2727,7 @@ void Scene2200::Action3::signal() { _actionIndex = 8; setDelay(5); } else { - for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); + for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) { (*i)->hide(); } @@ -2731,7 +2744,7 @@ void Scene2200::Action3::signal() { scene->_hotspot7.setFrame(1); scene->_hotspot7.setPosition(Common::Point(145, 165)); - SceneItem::display(60, 1, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOUR, -1, SET_FG_COLOUR, 34, + SceneItem::display(60, 1, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOR, -1, SET_FG_COLOR, 34, SET_POS_MODE, 0, SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END); _state = 1; setDelay(1800); @@ -2740,7 +2753,7 @@ void Scene2200::Action3::signal() { case 3: case 4: case 5: - SceneItem::display(60, _actionIndex - 2, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOUR, -1, SET_FG_COLOUR, 34, + SceneItem::display(60, _actionIndex - 2, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOR, -1, SET_FG_COLOR, 34, SET_POS_MODE, 0, SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END); setDelay(1800); break; @@ -2751,7 +2764,7 @@ void Scene2200::Action3::signal() { setDelay(5); break; case 7: - for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); + for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) (*i)->show(); @@ -2907,7 +2920,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) { _hotspot8.setVisage(2840); _hotspot8.setStrip(2); _hotspot8.setPosition(Common::Point(96, 184)); - _hotspot8.setPriority2(236); + _hotspot8.fixPriority(236); _globals->_player.postInit(); _globals->_player.setVisage(2640); @@ -2930,25 +2943,25 @@ void Scene2200::postInit(SceneObjectList *OwnerList) { _hotspot1.postInit(); _hotspot1.setVisage(2202); _hotspot1.setPosition(Common::Point(175, 173)); - _hotspot1.setPriority2(99); + _hotspot1.fixPriority(99); _hotspot3.postInit(); _hotspot3.setVisage(2202); _hotspot3._strip = 2; _hotspot3.setPosition(Common::Point(152, 76)); - _hotspot3.setPriority2(100); + _hotspot3.fixPriority(100); _hotspot4.postInit(); _hotspot4.setVisage(2202); _hotspot4._strip = 3; _hotspot4.setPosition(Common::Point(115, 76)); - _hotspot4.setPriority2(200); + _hotspot4.fixPriority(200); setAction(&_action1); break; case 2310: default: - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _hotspot3.postInit(); _hotspot3.setVisage(2215); @@ -2959,7 +2972,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) { _hotspot4.setVisage(2215); _hotspot4._strip = 2; _hotspot4.setPosition(Common::Point(120, 78)); - _hotspot4.setPriority2(255); + _hotspot4.fixPriority(255); _globals->_sceneItems.push_back(&_hotspot4); _soundHandler1.startSound(101); @@ -2993,9 +3006,9 @@ void Scene2200::stripCallback(int v) { } } -void Scene2200::synchronise(Serialiser &s) { - Scene::synchronise(s); - _exitRect.synchronise(s); +void Scene2200::synchronize(Serializer &s) { + Scene::synchronize(s); + _exitRect.synchronize(s); } void Scene2200::signal() { @@ -3096,7 +3109,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) { _hotspot5.postInit(); _hotspot5.setVisage(3401); _hotspot5.setStrip2(2); - _hotspot5._frame = 5; + _hotspot5.setFrame(5); _hotspot5.animate(ANIM_MODE_2, 0); if (_globals->_sceneManager._previousScene == 2100) { @@ -3118,7 +3131,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) { } _soundHandler.startSound(116); - _globals->_sceneManager._scene->_sceneBounds.centre(_hotspot1._position); + _globals->_sceneManager._scene->_sceneBounds.center(_hotspot1._position); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; @@ -3197,7 +3210,7 @@ void Scene2230::Action2::signal() { case 2: _globals->_player.setVisage(2235); _globals->_player.setStrip2(1); - _globals->_player.setPriority2(100); + _globals->_player.fixPriority(100); _globals->_player._frame = 1; _globals->_player.setPosition(Common::Point(200, 68)); _globals->_player.animate(ANIM_MODE_5, this); @@ -3241,7 +3254,7 @@ void Scene2230::Action3::signal() { _globals->_player.setVisage(0); _globals->_player.setStrip2(-1); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.setPosition(Common::Point(164, 96)); _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player._canWalk = true; @@ -3284,7 +3297,7 @@ void Scene2230::Action5::signal() { break; } case 2: - _globals->_player.setPriority2(1430); + _globals->_player.fixPriority(1430); _globals->_player.setVisage(2232); _globals->_player._strip = 1; _globals->_player._frame = 1; @@ -3306,7 +3319,7 @@ void Scene2230::Action6::signal() { case 0: _globals->_player._strip = 2; _globals->_player._frame = 1; - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.animate(ANIM_MODE_5, this); break; case 1: @@ -3359,7 +3372,7 @@ void Scene2230::Action7::signal() { scene->_hotspot2.setVisage(2231); scene->_hotspot2._strip = 3; scene->_hotspot2.setPosition(Common::Point(166, 116)); - scene->_hotspot2.setPriority2(131); + scene->_hotspot2.fixPriority(131); scene->_hotspot2.animate(ANIM_MODE_5, this); scene->_hotspot8._frame = 2; @@ -3425,7 +3438,7 @@ void Scene2230::Action8::signal() { scene->_hotspot2._strip = 3; scene->_hotspot2._frame = scene->_hotspot2.getFrameCount(); scene->_hotspot2.setPosition(Common::Point(166, 116)); - scene->_hotspot2.setPriority2(131); + scene->_hotspot2.fixPriority(131); scene->_hotspot2.animate(ANIM_MODE_6, this); break; case 4: { @@ -3688,7 +3701,7 @@ void Scene2230::postInit(SceneObjectList *OwnerList) { _hotspot8.animate(ANIM_MODE_NONE, 0); _hotspot8.setPosition(Common::Point(164, 133)); _hotspot8.changeZoom(100); - _hotspot8.setPriority2(129); + _hotspot8.fixPriority(129); _rect1 = Rect(59, 64, 89, 74); @@ -3720,9 +3733,9 @@ void Scene2230::postInit(SceneObjectList *OwnerList) { _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; } -void Scene2230::synchronise(Serialiser &s) { - Scene::synchronise(s); - _rect1.synchronise(s); +void Scene2230::synchronize(Serializer &s) { + Scene::synchronize(s); + _rect1.synchronize(s); s.syncAsSint16LE(_field30A); } @@ -3766,7 +3779,7 @@ void Scene2280::Action1::signal() { setDelay(10); break; case 4: - _globals->_player.setPriority2(1); + _globals->_player.fixPriority(1); scene->_soundHandler.startSound(162); scene->_hotspot16.animate(ANIM_MODE_6, this); break; @@ -3849,7 +3862,7 @@ void Scene2280::Action3::signal() { scene->_hotspot12._strip = 2; scene->_hotspot12._frame = 3; scene->_hotspot12.setPosition(Common::Point(88, 76)); - scene->_hotspot12.setPriority2(1); + scene->_hotspot12.fixPriority(1); _globals->_player.animate(ANIM_MODE_6, this); break; @@ -3867,7 +3880,7 @@ void Scene2280::Action3::signal() { scene->_hotspot8.animate(ANIM_MODE_NONE, NULL); scene->_hotspot8.setPosition(Common::Point(79, 108)); scene->_hotspot8.changeZoom(100); - scene->_hotspot8.setPriority2(1); + scene->_hotspot8.fixPriority(1); scene->_hotspot10.postInit(); scene->_hotspot10.setVisage(2280); @@ -3876,7 +3889,7 @@ void Scene2280::Action3::signal() { scene->_hotspot10.animate(ANIM_MODE_NONE, NULL); scene->_hotspot10.setPosition(Common::Point(79, 104)); scene->_hotspot10.changeZoom(100); - scene->_hotspot10.setPriority2(1); + scene->_hotspot10.fixPriority(1); _globals->clearFlag(13); @@ -3925,11 +3938,11 @@ void Scene2280::Action4::signal() { switch (_state) { case 1: scene->_hotspot18.remove(); - _globals->_inventory._scanner._sceneNumber = 1; + RING_INVENTORY._scanner._sceneNumber = 1; break; case 6: scene->_hotspot17.remove(); - _globals->_inventory._medkit._sceneNumber = 1; + RING_INVENTORY._medkit._sceneNumber = 1; break; case 50: scene->_hotspot17.postInit(); @@ -3939,9 +3952,9 @@ void Scene2280::Action4::signal() { scene->_hotspot17.animate(ANIM_MODE_NONE, NULL); scene->_hotspot17.setPosition(Common::Point(162, 39)); scene->_hotspot17.changeZoom(100); - scene->_hotspot17.setPriority2(1); + scene->_hotspot17.fixPriority(1); - _globals->_inventory._medkit._sceneNumber = 2280; + RING_INVENTORY._medkit._sceneNumber = 2280; _globals->_sceneItems.push_front(&scene->_hotspot17); break; case 51: @@ -3952,9 +3965,9 @@ void Scene2280::Action4::signal() { scene->_hotspot18.animate(ANIM_MODE_NONE, NULL); scene->_hotspot18.setPosition(Common::Point(152, 43)); scene->_hotspot18.changeZoom(100); - scene->_hotspot18.setPriority2(1); + scene->_hotspot18.fixPriority(1); - _globals->_inventory._scanner._sceneNumber = 2280; + RING_INVENTORY._scanner._sceneNumber = 2280; _globals->_sceneItems.push_front(&scene->_hotspot18); break; } @@ -4221,25 +4234,25 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _hotspot16.postInit(); _hotspot16.setVisage(2281); _hotspot16.setPosition(Common::Point(208, 90)); - _hotspot16.setPriority2(80); + _hotspot16.fixPriority(80); - if (_globals->_inventory._medkit._sceneNumber == 2280) { + if (RING_INVENTORY._medkit._sceneNumber == 2280) { _hotspot17.postInit(); _hotspot17.setVisage(2161); _hotspot17._strip = 2; _hotspot17.setPosition(Common::Point(162, 39)); - _hotspot17.setPriority2(1); + _hotspot17.fixPriority(1); _globals->_sceneItems.push_back(&_hotspot17); } - if (_globals->_inventory._scanner._sceneNumber == 2280) { + if (RING_INVENTORY._scanner._sceneNumber == 2280) { _hotspot18.postInit(); _hotspot18.setVisage(2161); _hotspot18._strip = 2; _hotspot18._frame = 2; _hotspot17.setPosition(Common::Point(152, 43)); - _hotspot17.setPriority2(1); + _hotspot17.fixPriority(1); _globals->_sceneItems.push_back(&_hotspot17); } @@ -4249,21 +4262,21 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _hotspot8.setVisage(2280); _hotspot8._strip = 2; _hotspot8.setPosition(Common::Point(79, 108)); - _hotspot8.setPriority2(1); + _hotspot8.fixPriority(1); _hotspot10.postInit(); _hotspot10.setVisage(2280); _hotspot10._strip = 2; _hotspot10._frame = 2; _hotspot10.setPosition(Common::Point(79, 104)); - _hotspot10.setPriority2(2); + _hotspot10.fixPriority(2); _hotspot12.postInit(); _hotspot12.setVisage(2280); _hotspot12._strip = 2; _hotspot12._frame = 3; _hotspot12.setPosition(Common::Point(88, 76)); - _hotspot12.setPriority2(1); + _hotspot12.fixPriority(1); _globals->_sceneItems.addItems(&_hotspot8, &_hotspot10, &_hotspot12, NULL); } @@ -4273,19 +4286,19 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _hotspot9.postInit(); _hotspot9.setVisage(2280); _hotspot9.setPosition(Common::Point(104, 96)); - _hotspot9.setPriority2(1); + _hotspot9.fixPriority(1); _hotspot11.postInit(); _hotspot11.setVisage(2280); _hotspot11._frame = 2; _hotspot11.setPosition(Common::Point(130, 79)); - _hotspot11.setPriority2(1); + _hotspot11.fixPriority(1); _hotspot13.postInit(); _hotspot13.setVisage(2280); _hotspot13._frame = 3; _hotspot13.setPosition(Common::Point(113, 63)); - _hotspot13.setPriority2(1); + _hotspot13.fixPriority(1); _hotspot1.setBounds(Rect(225, 70, 234, 80)); _hotspot2.setBounds(Rect(44, 78, 56, 105)); @@ -4310,7 +4323,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); } else { _globals->setFlag(109); - _globals->_player.setPriority2(76); + _globals->_player.fixPriority(76); _globals->_player.disableControl(); _sceneMode = 2281; @@ -4329,7 +4342,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) { void Scene2280::signal() { if (_sceneMode == 2281) { - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.enableControl(); } } @@ -4342,9 +4355,9 @@ void Scene2280::dispatch() { } } -void Scene2280::synchronise(Serialiser &s) { - Scene::synchronise(s); - _exitRect.synchronise(s); +void Scene2280::synchronize(Serializer &s) { + Scene::synchronize(s); + _exitRect.synchronize(s); } /*-------------------------------------------------------------------------- @@ -4422,7 +4435,7 @@ void Scene2300::Action1::signal() { _globals->_soundHandler.startSound(77, this); break; case 8: - _globals->_game.endGame(2300, 0); + _globals->_game->endGame(2300, 0); break; case 9: if (scene->_hotspot5._mover) @@ -4454,8 +4467,8 @@ void Scene2300::Action1::signal() { scene->_hotspot6._frame = 1; scene->_hotspot5.animate(ANIM_MODE_5, NULL); scene->_hotspot6.animate(ANIM_MODE_5, NULL); - scene->_hotspot5.setPriority2(20); - scene->_hotspot6.setPriority2(20); + scene->_hotspot5.fixPriority(20); + scene->_hotspot6.fixPriority(20); _globals->_player.setVisage(2672); _globals->_player._strip = 5; @@ -4546,7 +4559,7 @@ void Scene2300::Action2::signal() { case 7: scene->_hotspot7._strip = 2; scene->_hotspot7._frame = 1; - scene->_hotspot7.animate(ANIM_MODE_7, this); + scene->_hotspot7.animate(ANIM_MODE_5, this); break; case 8: scene->_hotspot2.animate(ANIM_MODE_6, this); @@ -4626,7 +4639,7 @@ void Scene2300::Action4::signal() { scene->_hotspot9.setStrip2(2); scene->_hotspot9.setFrame(3); scene->_hotspot9.setPosition(Common::Point(273, 199)); - scene->_hotspot9.setPriority2(19); + scene->_hotspot9.fixPriority(19); scene->_hotspot9.animate(ANIM_MODE_5, this); scene->_soundHandler1.startSound(11); break; @@ -4672,7 +4685,7 @@ void Scene2300::Hotspot5::doAction(int action) { } } -void Scene2300::Hotspot6::doAction(int action) { +void Scene2300::Hotspot7::doAction(int action) { Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene; switch (action) { @@ -4707,12 +4720,12 @@ void Scene2300::postInit(SceneObjectList *OwnerList) { setZoomPercents(0, 100, 200, 100); _stripManager.addSpeaker(&_speakerSL); - _stripManager.addSpeaker(&_speakerML); + _stripManager.addSpeaker(&_speakerMText); _stripManager.addSpeaker(&_speakerQText); _stripManager.addSpeaker(&_speakerSText); - _globals->_inventory._stunner._sceneNumber = 1; - _globals->_inventory._infoDisk._sceneNumber = 1; + RING_INVENTORY._stunner._sceneNumber = 1; + RING_INVENTORY._infoDisk._sceneNumber = 1; _hotspot8.postInit(); _hotspot8.setVisage(2301); @@ -4727,7 +4740,7 @@ void Scene2300::postInit(SceneObjectList *OwnerList) { _hotspot9.setStrip2(2); _hotspot9._frame = _hotspot9.getFrameCount(); _hotspot9.setPosition(Common::Point(273, 199)); - _hotspot9.setPriority2(1); + _hotspot9.fixPriority(1); _hotspot10.postInit(); _hotspot10.setVisage(2301); @@ -4864,29 +4877,32 @@ void Scene2310::postInit(SceneObjectList *OwnerList) { _globals->_events.setCursor(CURSOR_WALK); _wireIndex = 5; - _pageIndex = _globals->_randomSource.getRandomNumber(19) + 1; + if (_vm->getFeatures() & GF_CD) + _pageIndex = _globals->_randomSource.getRandomNumber(14) + 2; + else + _pageIndex = _globals->_randomSource.getRandomNumber(19) + 1; signal(); } void Scene2310::signal() { switch (_sceneMode++) { case 0: { - Common::String fmtString = _vm->_dataManager->getMessage(2300, 22); + Common::String fmtString = _resourceManager->getMessage(2300, 22); Common::String msg = Common::String::format(fmtString.c_str(), _pageList[_pageIndex]._pageNumber); _sceneText._width = 280; - _sceneText._textMode = ALIGN_CENTRE; - _sceneText._colour1 = 35; + _sceneText._textMode = ALIGN_CENTER; + _sceneText._color1 = 35; _sceneText._fontNumber = 2; _sceneText.setup(msg); - _sceneText.setPriority2(255); + _sceneText.fixPriority(255); _sceneText.setPosition(Common::Point(30, 20)); break; } case 1: { - Common::String msg = _vm->_dataManager->getMessage(2300, 23); + Common::String msg = _resourceManager->getMessage(2300, 23); _sceneText.setup(msg); - _sceneText.setPriority2(255); + _sceneText.fixPriority(255); _sceneText.setPosition(Common::Point(30, 170)); _globals->_sceneObjects->draw(); @@ -4901,8 +4917,8 @@ void Scene2310::signal() { } } -void Scene2310::synchronise(Serialiser &s) { - Scene::synchronise(s); +void Scene2310::synchronize(Serializer &s) { + Scene::synchronize(s); s.syncAsSint16LE(_wireIndex); s.syncAsSint16LE(_pageIndex); @@ -4966,10 +4982,7 @@ void Scene2310::process(Event &event) { } void Scene2310::dispatch() { - if ((_vm->getFeatures() & GF_CD) && !ConfMan.getBool("copy_protection")) { - // CD version of Ringworld has the copy protection disabled - signal(); - } else if (_wireIndex != 5) { + if (_wireIndex != 5) { for (int idx = 0; idx < 5; ++idx) { if (_rectList[idx].contains(_globals->_events._mousePos)) { _wireList[_wireIndex].setFrame(idx + 2); @@ -5033,7 +5046,7 @@ void Scene2320::Action2::signal() { switch (_actionIndex++) { case 0: { scene->_soundHandler.startSound(253); - scene->_hotspot13.setPriority2(99); + scene->_hotspot13.fixPriority(99); Common::Point pt(scene->_hotspot13._position.x, 200); NpcMover *mover = new NpcMover(); @@ -5068,7 +5081,7 @@ void Scene2320::Action3::signal() { break; } case 3: - scene->_hotspot6.setPriority2(scene->_hotspot6._priority - 1); + _globals->_player.fixPriority(scene->_hotspot6._priority - 1); _globals->_player._strip = 3; setDelay(10); break; @@ -5122,7 +5135,7 @@ void Scene2320::Action3::signal() { break; case 5: { if (_state == 2320) - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); else _globals->_sceneManager.changeScene(_state); @@ -5165,13 +5178,13 @@ void Scene2320::Action4::signal() { break; case 3: _globals->_player.animate(ANIM_MODE_6, NULL); - scene->setAction(&scene->_action2); + setAction(&scene->_action2, this); break; case 4: { scene->_hotspot16.postInit(); scene->_hotspot16.setVisage(2331); scene->_hotspot16.setStrip(3); - scene->_hotspot16.setPriority2(149); + scene->_hotspot16.fixPriority(149); scene->_hotspot16.setPosition(Common::Point(320, 202)); scene->_hotspot16.show(); @@ -5181,14 +5194,14 @@ void Scene2320::Action4::signal() { break; } case 5: { - scene->_hotspot16.setPriority2(200); + scene->_hotspot16.fixPriority(200); Common::Point pt(320, 180); NpcMover *mover = new NpcMover(); scene->_hotspot16.addMover(mover, &pt, this); break; } case 6: { - scene->_hotspot16.setPriority2(-1); + scene->_hotspot16.fixPriority(-1); _globals->_player.setVisage(0); _globals->_player.animate(ANIM_MODE_1, NULL); @@ -5262,7 +5275,7 @@ void Scene2320::Action4::signal() { } case 17: { _globals->_player.animate(ANIM_MODE_6, NULL); - scene->_hotspot16.setPriority2(160); + scene->_hotspot16.fixPriority(160); Common::Point pt(320, 121); NpcMover *mover = new NpcMover(); @@ -5290,7 +5303,7 @@ void Scene2320::Action4::signal() { _globals->_player.setVisage(0); _globals->_player.animate(ANIM_MODE_1, NULL); - scene->_hotspot13.setPriority2(1); + scene->_hotspot13.fixPriority(1); remove(); break; } @@ -5320,7 +5333,7 @@ void Scene2320::Action5::signal() { _globals->_player.setVisage(2347); _globals->_player.setStrip(1); _globals->_player.setFrame(1); - _globals->_player.setPriority2(137); + _globals->_player.fixPriority(137); _globals->_player.animate(ANIM_MODE_5, this); break; case 5: @@ -5333,7 +5346,7 @@ void Scene2320::Action5::signal() { _globals->_sceneManager.changeScene(7000); else if (_globals->getFlag(59)) _globals->_sceneManager.changeScene(5000); - else if (!_globals->getFlag(43) || (_globals->_inventory._ale._sceneNumber != 1)) + else if (!_globals->getFlag(43) || (RING_INVENTORY._ale._sceneNumber != 1)) setDelay(10); else { scene->_hotspot11.setAction(NULL); @@ -5345,7 +5358,7 @@ void Scene2320::Action5::signal() { NpcMover *mover = new NpcMover(); scene->_hotspot11.addMover(mover, &pt, NULL); - _globals->clearFlag(53); + _globals->clearFlag(43); scene->_stripManager.start(2325, this); } break; @@ -5376,7 +5389,7 @@ void Scene2320::Action6::signal() { case 3: _globals->_player.setVisage(0); _globals->_player.setStrip(3); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.animate(ANIM_MODE_1, NULL); @@ -5432,12 +5445,12 @@ void Scene2320::Action7::signal() { scene->_hotspot6.animate(ANIM_MODE_5, this); break; case 2: - scene->_hotspot10.setPriority2(-1); + scene->_hotspot10.fixPriority(-1); ADD_MOVER_NULL(scene->_hotspot10, 321, 94); - scene->_hotspot11.setPriority2(-1); + scene->_hotspot11.fixPriority(-1); ADD_MOVER_NULL(scene->_hotspot11, 346, 85); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); ADD_MOVER(_globals->_player, 297, 89); break; case 3: @@ -5454,10 +5467,6 @@ void Scene2320::Action7::signal() { case 6: ADD_MOVER_NULL(scene->_hotspot10, 491, 160); ADD_MOVER(_globals->_player, 391, 88); - - _globals->_player.setStrip(1); - _globals->_player.setFrame(1); - _globals->_player.animate(ANIM_MODE_6, this); break; case 7: ADD_PLAYER_MOVER(462, 182); @@ -5477,7 +5486,7 @@ void Scene2320::Action7::signal() { break; case 12: _globals->_player.enableControl(); - _globals->_inventory._stasisBox._sceneNumber = 2320; + RING_INVENTORY._stasisBox._sceneNumber = 2320; break; } } @@ -5507,7 +5516,7 @@ void Scene2320::Action8::signal() { _globals->_player.enableControl(); break; case 5: - _globals->_inventory._stasisBox._sceneNumber = 2320; + RING_INVENTORY._stasisBox._sceneNumber = 2320; scene->_sceneMode = 2326; scene->_speakerGameText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 30, 10)); scene->setAction(&scene->_sequenceManager1, scene, 2326, &_globals->_player, &scene->_hotspot11, NULL); @@ -5622,12 +5631,12 @@ void Scene2320::Hotspot11::doAction(int action) { } else { scene->_sceneMode = 2329; - if (_globals->_inventory._ale._sceneNumber == 1) { + if (RING_INVENTORY._ale._sceneNumber == 1) { scene->setAction(&scene->_sequenceManager1, scene, 2329, NULL); } else if (!_globals->getFlag(110)) { _globals->setFlag(110); scene->setAction(&scene->_sequenceManager1, scene, 2330, NULL); - } else if (_globals->_inventory._peg._sceneNumber != 1) { + } else if (RING_INVENTORY._peg._sceneNumber != 1) { scene->setAction(&scene->_sequenceManager1, scene, 2331, NULL); } else if (!_state) { ++_state; @@ -5683,13 +5692,13 @@ void Scene2320::Hotspot14::doAction(int action) { scene->_hotspot8.hide(); _globals->_sceneItems.push_front(&scene->_hotspot8); - _globals->_inventory._waldos._sceneNumber = 2320; + RING_INVENTORY._waldos._sceneNumber = 2320; scene->_hotspot9.postInit(); scene->_hotspot9.setVisage(2345); scene->_hotspot9._strip = 6; scene->_hotspot9.setPosition(Common::Point(536, 103)); - scene->_hotspot9.setPriority2(200); + scene->_hotspot9.fixPriority(200); scene->_hotspot9.hide(); scene->_hotspot16.postInit(); @@ -5705,7 +5714,7 @@ void Scene2320::Hotspot14::doAction(int action) { SceneItem::display2(2320, 24); } else if (!_globals->getFlag(76)) { SceneItem::display2(2320, 28); - } else if (!_globals->_inventory._waldos._sceneNumber) { + } else if (!RING_INVENTORY._waldos._sceneNumber) { SceneItem::display2(2320, 27); } else { SceneItem::display2(2320, 29); @@ -5779,7 +5788,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot13.postInit(); _hotspot13.setVisage(2323); _hotspot13.setPosition(Common::Point(319, 157)); - _hotspot13.setPriority2(1); + _hotspot13.fixPriority(1); _hotspot12.postInit(); _hotspot12.setVisage(2321); @@ -5787,18 +5796,18 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot12.animate(ANIM_MODE_8, 0, NULL); _hotspot12.setPosition(Common::Point(412, 46)); - if (_globals->_inventory._waldos._sceneNumber == 2320) { + if (RING_INVENTORY._waldos._sceneNumber == 2320) { _hotspot8.postInit(); _hotspot8.setVisage(2345); _hotspot8.setStrip(5); _hotspot8.setFrame(8); _hotspot8.setPosition(Common::Point(541, 103)); - _hotspot8.setPriority2(201); + _hotspot8.fixPriority(201); _globals->_sceneItems.push_back(&_hotspot8); } - _area1.setup(2100, 2, 1, 2150); + _area1.setup(2153, 2, 1, 2100); _area1._pt = Common::Point(200, 31); _area2.setup(2153, 3, 1, 2150); _area2._pt = Common::Point(200, 50); @@ -5812,17 +5821,20 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot11.setVisage(2705); _hotspot11._strip = 3; _hotspot11.setPosition(Common::Point(510, 156)); + _globals->_sceneItems.push_back(&_hotspot11); _hotspot11._state = 0; _hotspot11.setAction(&_action1); - - _globals->_sceneItems.push_back(&_hotspot11); } _globals->_player.postInit(); + if (_globals->getFlag(13)) + _globals->_player.setVisage(2170); + else + _globals->_player.setVisage(0); _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setPosition(Common::Point(320, 79)); - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); _globals->_player.changeZoom(-1); _globals->_player._moveDiff.y = 3; _globals->_player.disableControl(); @@ -5857,7 +5869,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_soundHandler.startSound(160); _globals->_soundHandler.proc5(true); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.setPosition(Common::Point(389, 72)); _globals->_player.enableControl(); break; @@ -5883,7 +5895,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(2347); _globals->_player.setStrip(2); _globals->_player.setFrame(5); - _globals->_player.setPriority2(137); + _globals->_player.fixPriority(137); _globals->_player.setPosition(Common::Point(165, 132)); setAction(&_action6); @@ -5909,7 +5921,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _globals->_player.setStrip(2); _globals->_player.setFrame(_globals->_player.getFrameCount()); _globals->_player.setPosition(Common::Point(303, 176)); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.disableControl(); _hotspot13.setPosition(Common::Point(319, 199)); @@ -5917,7 +5929,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot16.postInit(); _hotspot16.setVisage(2331); _hotspot16._strip = 3; - _hotspot16.setPriority2(160); + _hotspot16.fixPriority(160); _hotspot16.setPosition(Common::Point(320, 202)); _hotspot16.hide(); @@ -5934,7 +5946,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot11.postInit(); _hotspot11.setVisage(2705); _hotspot11._strip = 2; - _hotspot11.setPriority2(10); + _hotspot11.fixPriority(10); _hotspot11.setPosition(Common::Point(322, 80)); _hotspot11.setObjectWrapper(new SceneObjectWrapper()); _hotspot11.animate(ANIM_MODE_1, NULL); @@ -5943,7 +5955,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { _hotspot10.setVisage(2806); _hotspot10.setObjectWrapper(new SceneObjectWrapper()); _hotspot10.changeZoom(-1); - _hotspot10.setPriority2(10); + _hotspot10.fixPriority(10); _hotspot10.setPosition(Common::Point(318, 89)); _hotspot10._strip = 3; _hotspot10.animate(ANIM_MODE_1, NULL); @@ -5971,7 +5983,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { } _globals->_stripNum = 0; - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position); loadScene(2320); _hotspot14._sceneRegionId = 8; @@ -5986,8 +5998,8 @@ void Scene2320::postInit(SceneObjectList *OwnerList) { &_hotspot13, &_hotspot4, &_hotspot3, &_hotspot2, &_hotspot1, NULL); } -void Scene2320::synchronise(Serialiser &s) { - Scene::synchronise(s); +void Scene2320::synchronize(Serializer &s) { + Scene::synchronize(s); SYNC_POINTER(_hotspotPtr); } @@ -6019,13 +6031,13 @@ void Scene2320::signal() { break; case 2326: _globals->clearFlag(70); - _globals->_inventory._nullifier._sceneNumber = 1; + RING_INVENTORY._nullifier._sceneNumber = 1; _globals->_stripNum = 2321; _globals->_sceneManager.changeScene(2100); break; case 2336: _globals->setFlag(77); - _globals->_inventory._waldos._sceneNumber = 1; + RING_INVENTORY._waldos._sceneNumber = 1; _hotspot8.remove(); break; case 5000: @@ -6088,7 +6100,7 @@ void Scene2400::postInit(SceneObjectList *OwnerList) { setAction(&_action1); - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; diff --git a/engines/tsage/ringworld_scenes3.h b/engines/tsage/ringworld_scenes3.h index 61aac522f2..a25bf8834b 100644 --- a/engines/tsage/ringworld_scenes3.h +++ b/engines/tsage/ringworld_scenes3.h @@ -324,7 +324,7 @@ public: int _lineOffset; virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); }; class Scene2150 : public Scene { @@ -381,7 +381,7 @@ public: Scene2150(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); virtual void dispatch(); }; @@ -446,7 +446,7 @@ public: Scene2200(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void stripCallback(int v); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); virtual void dispatch(); }; @@ -462,8 +462,6 @@ class Scene2222 : public Scene { virtual void signal(); }; - /* Hotspots */ - public: SoundHandler _soundHandler; SpeakerSText _speakerSText; @@ -581,7 +579,7 @@ public: Scene2230(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void dispatch(); }; @@ -681,7 +679,7 @@ public: Scene2280(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); virtual void dispatch(); }; @@ -710,22 +708,14 @@ class Scene2300 : public Scene { public: virtual void doAction(int action); }; - class Hotspot6 : public SceneObject { - public: - virtual void doAction(int action); - }; - class Hotspot12 : public SceneObject { - public: - virtual void doAction(int action); - }; - class Hotspot13 : public SceneObject { + class Hotspot7 : public SceneObject { public: virtual void doAction(int action); }; public: SoundHandler _soundHandler1, _soundHandler2; SpeakerSL _speakerSL; - SpeakerML _speakerML; + SpeakerMText _speakerMText; SpeakerQText _speakerQText; SpeakerSText _speakerSText; Action1 _action1; @@ -734,8 +724,9 @@ public: Action4 _action4; SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4; Hotspot5 _hotspot5; - Hotspot6 _hotspot6; - SceneObject _hotspot7, _hotspot8, _hotspot9, _hotspot10; + SceneObject _hotspot6; + Hotspot7 _hotspot7; + SceneObject _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13, _hotspot14, _hotspot15; Scene2300(); @@ -769,7 +760,7 @@ public: Scene2310(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); virtual void process(Event &event); virtual void dispatch(); @@ -882,7 +873,7 @@ public: Scene2320(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void signal(); }; diff --git a/engines/tsage/ringworld_scenes4.cpp b/engines/tsage/ringworld_scenes4.cpp index 89feb223a1..c42b7819f2 100644 --- a/engines/tsage/ringworld_scenes4.cpp +++ b/engines/tsage/ringworld_scenes4.cpp @@ -113,8 +113,8 @@ Scene3700::Viewer::Viewer() { _percentList[3] = 114; } -void Scene3700::Viewer::synchronise(Serialiser &s) { - SceneObject::synchronise(s); +void Scene3700::Viewer::synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsByte(_active); s.syncAsSint16LE(_countdownCtr); for (int idx = 0; idx < 4; ++idx) { diff --git a/engines/tsage/ringworld_scenes4.h b/engines/tsage/ringworld_scenes4.h index f5dac297fc..53ea7be491 100644 --- a/engines/tsage/ringworld_scenes4.h +++ b/engines/tsage/ringworld_scenes4.h @@ -67,7 +67,7 @@ class Scene3700 : public Scene { Viewer(); virtual Common::String getClassName() { return "Viewer"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void dispatch(); virtual void reposition(); virtual void draw(); diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index de29a1cefc..dd9c33f0e5 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -47,9 +47,11 @@ void Scene4000::Action1::signal() { scene->_hotspot5.animate(ANIM_MODE_1, NULL); scene->_hotspot5.setPosition(Common::Point(116, 160)); - ADD_PLAYER_MOVER_NULL(scene->_hotspot5, 208, 169); + Common::Point pt(208, 169); + NpcMover *mover = new NpcMover(); + scene->_hotspot5.addMover(mover, &pt, this); - _globals->_inventory._ale._sceneNumber = 0; + RING_INVENTORY._ale._sceneNumber = 0; _globals->clearFlag(42); _globals->clearFlag(36); _globals->clearFlag(43); @@ -57,30 +59,33 @@ void Scene4000::Action1::signal() { break; } case 1: { - scene->_hotspot9.postInit(); - scene->_hotspot9.setVisage(4001); - scene->_hotspot9.animate(ANIM_MODE_1, NULL); - scene->_hotspot9.setObjectWrapper(new SceneObjectWrapper()); - scene->_hotspot9.setPosition(Common::Point(314, 132)); + scene->_guardRock.postInit(); + scene->_guardRock.setVisage(4001); + scene->_guardRock.animate(ANIM_MODE_1, NULL); + scene->_guardRock.setObjectWrapper(new SceneObjectWrapper()); + scene->_guardRock.setPosition(Common::Point(314, 132)); + scene->_guardRock._moveDiff = Common::Point(4, 2); - ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 288, 167); + ADD_PLAYER_MOVER_NULL(scene->_guardRock, 288, 167); - scene->_hotspot4.postInit(); - scene->_hotspot4.setVisage(4006); - scene->_hotspot4.animate(ANIM_MODE_1, NULL); - scene->_hotspot4.setStrip(1); - scene->_hotspot4.setPosition(Common::Point(207, 136)); + scene->_olo.postInit(); + scene->_olo.setVisage(4006); + scene->_olo.animate(ANIM_MODE_1, NULL); + scene->_olo.setStrip(1); + scene->_olo.setPosition(Common::Point(207, 136)); + + ADD_PLAYER_MOVER_NULL(scene->_olo, 220, 151); - ADD_PLAYER_MOVER_NULL(scene->_hotspot4, 220, 151); + scene->_miranda.postInit(); + scene->_miranda.setVisage(2701); + scene->_miranda.animate(ANIM_MODE_1, NULL); + scene->_miranda.setObjectWrapper(new SceneObjectWrapper()); + scene->_miranda._moveDiff = Common::Point(4, 2); + scene->_miranda.setPosition(Common::Point(300, 135)); - scene->_hotspot7.postInit(); - scene->_hotspot7.setVisage(2701); - scene->_hotspot7.animate(ANIM_MODE_1, NULL); - scene->_hotspot7.setObjectWrapper(new SceneObjectWrapper()); - scene->_hotspot7._moveDiff = Common::Point(4, 2); - scene->_hotspot7.setPosition(Common::Point(300, 135)); + ADD_PLAYER_MOVER_THIS(scene->_miranda, 266, 169); - ADD_PLAYER_MOVER_NULL(_globals->_player, 266, 169); + ADD_PLAYER_MOVER_NULL(_globals->_player, 241, 155); break; } case 2: @@ -89,14 +94,14 @@ void Scene4000::Action1::signal() { case 3: { Common::Point pt1(30, 86); PlayerMover *mover1 = new PlayerMover(); - scene->_hotspot7.addMover(mover1, &pt1, this); + scene->_miranda.addMover(mover1, &pt1, this); ADD_PLAYER_MOVER_NULL(scene->_hotspot5, 3, 86); break; } case 4: - ADD_MOVER(scene->_hotspot7, -30, 86); - ADD_MOVER(scene->_hotspot5, -40, 86); + ADD_MOVER(scene->_miranda, -30, 86); + ADD_MOVER_NULL(scene->_hotspot5, -40, 86); break; case 5: _globals->_soundHandler.startSound(155); @@ -105,7 +110,7 @@ void Scene4000::Action1::signal() { scene->_stripManager.start(4430, this); break; case 6: - ADD_PLAYER_MOVER_THIS(scene->_hotspot4, 277, 175); + ADD_PLAYER_MOVER_THIS(scene->_olo, 277, 175); ADD_PLAYER_MOVER_NULL(_globals->_player, 258, 187); break; case 7: @@ -135,19 +140,19 @@ void Scene4000::Action2::signal() { scene->_hotspot5._moveDiff.x = 5; scene->_hotspot5.setPosition(Common::Point(-8, 88)); - scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); + scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); break; case 1: _globals->_player.disableControl(); - scene->_hotspot3.remove(); - ADD_MOVER(scene->_hotspot9, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10); + scene->_lander.remove(); + ADD_MOVER(scene->_guardRock, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10); break; case 2: - _globals->_player.checkAngle(&scene->_hotspot9); - scene->_hotspot5.checkAngle(&scene->_hotspot9); - scene->_hotspot7.checkAngle(&scene->_hotspot9); + _globals->_player.checkAngle(&scene->_guardRock); + scene->_hotspot5.checkAngle(&scene->_guardRock); + scene->_miranda.checkAngle(&scene->_guardRock); scene->_stripManager.start(4000, this); break; case 3: @@ -166,9 +171,9 @@ void Scene4000::Action2::signal() { scene->_stripManager.start(4010, this); break; case 6: - ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 230, 149); + ADD_PLAYER_MOVER_NULL(scene->_guardRock, 230, 149); ADD_PLAYER_MOVER(210, 136); - ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 210, 133); + ADD_PLAYER_MOVER_NULL(scene->_miranda, 210, 133); break; case 7: _globals->_sceneManager.changeScene(4045); @@ -203,20 +208,20 @@ void Scene4000::Action4::signal() { ADD_MOVER(_globals->_player, 257, 57); break; case 1: - _globals->_player.setVisage(4000); + _globals->_player.setVisage(4008); _globals->_player.setPosition(Common::Point(258, 83)); _globals->_player._frame = 1; _globals->_player._strip = 3; _globals->_player.animate(ANIM_MODE_4, 2, 1, this); break; case 2: - scene->_hotspot6.postInit(); - scene->_hotspot6.setVisage(4000); - scene->_hotspot6.setStrip(7); - scene->_hotspot6.setFrame(3); - scene->_hotspot6.setPosition(Common::Point(268, 44)); + scene->_rope.postInit(); + scene->_rope.setVisage(4000); + scene->_rope.setStrip(7); + scene->_rope.setFrame(3); + scene->_rope.setPosition(Common::Point(268, 44)); - _globals->_inventory._rope._sceneNumber = 4000; + RING_INVENTORY._rope._sceneNumber = 4000; _globals->_events.setCursor(CURSOR_USE); _globals->_player.animate(ANIM_MODE_6, this); break; @@ -270,23 +275,23 @@ void Scene4000::Action6::signal() { setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL); if (!_globals->getFlag(36)) - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); break; case 2: _globals->_player.disableControl(); - ADD_MOVER(scene->_hotspot9, _globals->_player._position.x + 30, _globals->_player._position.y - 5); + ADD_MOVER(scene->_guardRock, _globals->_player._position.x + 30, _globals->_player._position.y - 5); break; case 3: scene->_stripManager.start(_globals->getFlag(35) ? 4500 : 4502, this); break; case 4: _globals->clearFlag(35); - ADD_MOVER_NULL(scene->_hotspot9, 292, 138); + ADD_MOVER_NULL(scene->_guardRock, 292, 138); ADD_PLAYER_MOVER(283, 147); - if (!_globals->getFlag(36)) { - ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 280, 150); - } + if (!_globals->getFlag(36)) + ADD_PLAYER_MOVER_NULL(scene->_miranda, 280, 150); + RING_INVENTORY._ale._sceneNumber = 4100; break; case 5: _globals->_sceneManager.changeScene(4100); @@ -295,20 +300,21 @@ void Scene4000::Action6::signal() { } void Scene4000::Action7::signal() { + // Climb down left Chimney using a rope Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { case 0: _globals->_player.disableControl(); - scene->_hotspot6.setFrame(1); + scene->_rope.setFrame(1); ADD_MOVER(_globals->_player, 247, 53); break; case 1: _globals->_player.setVisage(4008); _globals->_player.setStrip(4); _globals->_player.setFrame(1); - _globals->_player.setPriority2(16); + _globals->_player.fixPriority(16); _globals->_player.setPosition(Common::Point(260, 55)); _globals->_player.animate(ANIM_MODE_5, this); break; @@ -325,7 +331,7 @@ void Scene4000::Action8::signal() { case 0: _globals->_player.disableControl(); if (_globals->getFlag(41)) - scene->_hotspot6.setFrame(2); + scene->_rope.setFrame(2); ADD_MOVER(_globals->_player, 289, 53); break; @@ -343,16 +349,16 @@ void Scene4000::Action8::signal() { break; case 3: _globals->_soundHandler.startSound(170); - scene->_hotspot27.setVisage(4000); - scene->_hotspot27.setStrip(6); - scene->_hotspot27.animate(ANIM_MODE_2, NULL); + scene->_smoke2.setVisage(4000); + scene->_smoke2.setStrip(6); + scene->_smoke2.animate(ANIM_MODE_2, NULL); setDelay(60); break; case 4: _globals->_soundHandler.startSound(77, this); break; case 5: - _globals->_game.endGame(4000, 15); + _globals->_game->endGame(4000, 15); remove(); break; } @@ -388,7 +394,7 @@ void Scene4000::Action11::signal() { switch (_actionIndex++) { case 0: _globals->_player.disableControl(); - ADD_MOVER(scene->_hotspot3, -30, 70); + ADD_MOVER(scene->_lander, -30, 70); break; case 1: setDelay(60); @@ -403,23 +409,23 @@ void Scene4000::Action11::signal() { setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL); - scene->_hotspot7.setPosition(Common::Point(-210, 139)); - scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL); - scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); + scene->_miranda.setPosition(Common::Point(-210, 139)); + scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL); + scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL); break; case 3: scene->_stripManager.start(8000, this); break; case 4: - ADD_MOVER(scene->_hotspot4, 263, 187); - scene->_hotspot4.animate(ANIM_MODE_1, NULL); + ADD_MOVER(scene->_olo, 263, 187); + scene->_olo.animate(ANIM_MODE_1, NULL); break; case 5: scene->_soundHandler1.proc3(); - scene->_hotspot11.remove(); + scene->_forceField.remove(); ADD_MOVER(_globals->_player, 340, 163); - ADD_MOVER_NULL(scene->_hotspot7, 340, 169); + ADD_MOVER_NULL(scene->_miranda, 340, 169); ADD_MOVER_NULL(scene->_hotspot5, 340, 165); break; case 6: @@ -444,7 +450,7 @@ void Scene4000::Action12::signal() { _globals->setFlag(32); if (scene->_stripManager._field2E8 == 275) { _globals->setFlag(82); - ADD_MOVER_NULL(scene->_hotspot9, 292, 138); + ADD_MOVER_NULL(scene->_guardRock, 292, 138); ADD_PLAYER_MOVER(283, 147); } else { setDelay(30); @@ -454,11 +460,11 @@ void Scene4000::Action12::signal() { if (scene->_stripManager._field2E8 == 275) { _globals->_sceneManager.changeScene(4100); } else { - ADD_PLAYER_MOVER_THIS(scene->_hotspot9, 300, 132); + ADD_PLAYER_MOVER_THIS(scene->_guardRock, 300, 132); } break; case 4: - scene->_hotspot9.hide(); + scene->_guardRock.hide(); scene->_stripManager.start(4020, this); break; case 5: @@ -480,7 +486,7 @@ void Scene4000::Action13::signal() { case 1: scene->_soundHandler2.startSound(151); scene->_soundHandler2.proc5(true); - ADD_MOVER(scene->_hotspot3, -30, 70); + ADD_MOVER(scene->_lander, -30, 70); break; case 2: scene->_soundHandler2.proc4(); @@ -491,7 +497,7 @@ void Scene4000::Action13::signal() { /*--------------------------------------------------------------------------*/ -void Scene4000::Hotspot7::doAction(int action) { +void Scene4000::Miranda::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -545,7 +551,7 @@ void Scene4000::Hotspot8::doAction(int action) { SceneItem::display2(4000, 25); break; case CURSOR_TALK: - if (_globals->_inventory._peg._sceneNumber == 1) + if (RING_INVENTORY._peg._sceneNumber == 1) SceneItem::display2(4000, 34); else { switch (_ctr) { @@ -577,7 +583,7 @@ void Scene4000::Hotspot8::doAction(int action) { } } -void Scene4000::Hotspot9::doAction(int action) { +void Scene4000::GuardRock::doAction(int action) { switch (action) { case OBJECT_STUNNER: SceneItem::display2(4000, 28); @@ -594,7 +600,7 @@ void Scene4000::Hotspot9::doAction(int action) { } } -void Scene4000::Hotspot10::doAction(int action) { +void Scene4000::Ladder::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -608,7 +614,7 @@ void Scene4000::Hotspot10::doAction(int action) { scene->setAction(&scene->_sequenceManager1, scene, 4005, &_globals->_player, NULL); } else { scene->_sceneMode = 4004; - scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_hotspot10, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_ladder, NULL); } break; default: @@ -617,7 +623,7 @@ void Scene4000::Hotspot10::doAction(int action) { } } -void Scene4000::Hotspot12::doAction(int action) { +void Scene4000::TheTech::doAction(int action) { Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -635,7 +641,7 @@ void Scene4000::Hotspot12::doAction(int action) { SceneItem::display2(4000, 37); else { _globals->_player.disableControl(); - if (_globals->_sceneObjects->contains(&scene->_hotspot7)) + if (_globals->_sceneObjects->contains(&scene->_miranda)) _globals->clearFlag(96); scene->_sceneMode = 4012; @@ -649,6 +655,7 @@ void Scene4000::Hotspot12::doAction(int action) { } void Scene4000::Hotspot13::doAction(int action) { + // Rock Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -680,24 +687,27 @@ void Scene4000::Hotspot::doAction(int action) { case OBJECT_STUNNER: SceneItem::display2(4000, 18); break; - case OBJECT_LADDER: + case OBJECT_LADDER: { _globals->_player.disableControl(); - scene->_hotspot10.postInit(); - scene->_hotspot10.setVisage(4000); - scene->_hotspot10.setStrip(5); - scene->_hotspot10.setPosition(Common::Point(245, 147)); - scene->_hotspot10.hide(); - _globals->_sceneItems.push_front(&scene->_hotspot10); + scene->_ladder.postInit(); + scene->_ladder.setVisage(4000); + scene->_ladder.setStrip(5); + scene->_ladder.setPosition(Common::Point(245, 147)); + scene->_ladder.hide(); + _globals->_sceneItems.push_front(&scene->_ladder); if (_globals->_sceneObjects->contains(&scene->_hotspot8)) { scene->_hotspot8.setAction(NULL); - ADD_MOVER_NULL(scene->_hotspot8, 118, 145); + Common::Point pt(118, 145); + NpcMover *mover = new NpcMover(); + scene->_hotspot18.addMover(mover, &pt, NULL); } scene->_sceneMode = 4004; - scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_hotspot10, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_ladder, NULL); break; + } default: SceneHotspot::doAction(action); break; @@ -705,6 +715,7 @@ void Scene4000::Hotspot::doAction(int action) { } void Scene4000::Hotspot17::doAction(int action) { + // Left Chimney Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -724,6 +735,7 @@ void Scene4000::Hotspot17::doAction(int action) { } void Scene4000::Hotspot18::doAction(int action) { + // Right Chimney Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene; switch (action) { @@ -756,7 +768,7 @@ void Scene4000::Hotspot23::doAction(int action) { /*--------------------------------------------------------------------------*/ Scene4000::Scene4000() : - _hotspot11(0, CURSOR_LOOK, 4000, 14, CURSOR_USE, 4000, 32, OBJECT_STUNNER, 4000, 33, + _forceField(0, CURSOR_LOOK, 4000, 14, CURSOR_USE, 4000, 32, OBJECT_STUNNER, 4000, 33, OBJECT_SCANNER, 4000, 19, LIST_END), _hotspot19(0, CURSOR_LOOK, 4000, 7, LIST_END), _hotspot20(0, CURSOR_LOOK, 4000, 3, LIST_END), @@ -786,14 +798,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerSText); _stripManager.addSpeaker(&_speakerMText); - _speakerCHFText._npc = &_hotspot9; + _speakerCHFText._npc = &_guardRock; _speakerSText._npc = &_hotspot5; - _speakerMText._npc = &_hotspot7; - _speakerPText._npc = &_hotspot4; + _speakerMText._npc = &_miranda; + _speakerPText._npc = &_olo; _speakerQText._npc = &_globals->_player; _hotspot13.setBounds(Rect(263, 41, 278, 55)); - _hotspot14.setBounds(Rect(140, 177, 140 /*96*/, 204)); + _hotspot14.setBounds(Rect(96 /*140*/, 177, 140 /*96*/, 204)); _hotspot15.setBounds(Rect(227, 101, 264, 143)); _hotspot16.setBounds(Rect(306, 100, 319, 148)); _hotspot17.setBounds(Rect(231, 53, 254, 60)); @@ -808,22 +820,23 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot20._sceneRegionId = 18; _hotspot25._sceneRegionId = 17; - _hotspot1.postInit(); - _hotspot1.setVisage(4000); - _hotspot1.setPriority2(1); - _hotspot1.setFrame(2); - _hotspot1.setPosition(Common::Point(242, 59)); - _hotspot1.animate(ANIM_MODE_2, NULL); - - _hotspot27.postInit(); - _hotspot27.setVisage(4000); - _hotspot27.setStrip(2); - _hotspot27.setPriority2(1); - _hotspot27.setFrame(2); - _hotspot27.setPosition(Common::Point(299, 59)); - _hotspot27.animate(ANIM_MODE_2, NULL); - - if (_globals->_inventory._ladder._sceneNumber != 4000) { + _smoke1.postInit(); + _smoke1.setVisage(4000); + _smoke1.fixPriority(1); + _smoke1.setFrame(2); + _smoke1.setPosition(Common::Point(242, 59)); + _smoke1.animate(ANIM_MODE_2, NULL); + + _smoke2.postInit(); + _smoke2.setVisage(4000); + _smoke2.setStrip(2); + _smoke2.fixPriority(1); + _smoke2.setFrame(2); + _smoke2.setPosition(Common::Point(299, 59)); + _smoke2.animate(ANIM_MODE_2, NULL); + + if (RING_INVENTORY._ladder._sceneNumber != 4000) { + // if ladder is not in the scene, activate the hotspot on the wall _hotspot8.postInit(); _hotspot8.setVisage(4018); _hotspot8.setObjectWrapper(new SceneObjectWrapper()); @@ -833,24 +846,24 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot8.setAction(&_action9); } - _hotspot12.postInit(); - _hotspot12.setVisage(4000); - _hotspot12.setStrip(3); - _hotspot12.setFrame(3); - _hotspot12.setPriority2(200); - _hotspot12.setPosition(Common::Point(281, 176)); + _theTech.postInit(); + _theTech.setVisage(4000); + _theTech.setStrip(3); + _theTech.setFrame(3); + _theTech.fixPriority(200); + _theTech.setPosition(Common::Point(281, 176)); if (_globals->getFlag(34)) { _soundHandler1.startSound(156); - _hotspot11.postInit(); - _hotspot11.setVisage(4000); - _hotspot11.setStrip(4); - _hotspot11.setPosition(Common::Point(312, 174)); - _hotspot11.setPriority2(200); - _hotspot11.animate(ANIM_MODE_8, 0, NULL); + _forceField.postInit(); + _forceField.setVisage(4000); + _forceField.setStrip(4); + _forceField.setPosition(Common::Point(312, 174)); + _forceField.fixPriority(200); + _forceField.animate(ANIM_MODE_8, 0, NULL); - _globals->_sceneItems.push_back(&_hotspot11); + _globals->_sceneItems.push_back(&_forceField); } _globals->_player.postInit(); @@ -860,26 +873,28 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(-28, 86)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) { - _hotspot7.postInit(); - _hotspot7.setVisage(2701); - _hotspot7.animate(ANIM_MODE_1, NULL); - _hotspot7.setObjectWrapper(new SceneObjectWrapper()); - _hotspot7._moveDiff = Common::Point(4, 2); - _hotspot7.setPosition(Common::Point(-210, 139)); - - _globals->_sceneItems.push_back(&_hotspot7); + _miranda.postInit(); + _miranda.setVisage(2701); + _miranda.animate(ANIM_MODE_1, NULL); + _miranda.setObjectWrapper(new SceneObjectWrapper()); + _miranda._moveDiff = Common::Point(4, 2); + _miranda.setPosition(Common::Point(-210, 139)); + + _globals->_sceneItems.push_back(&_miranda); } + _globals->clearFlag(40); + switch (_globals->_sceneManager._previousScene) { case 2320: _globals->_soundHandler.startSound(155); - if (_globals->_inventory._ale._sceneNumber == 1) { - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(314, 132)); + if (RING_INVENTORY._ale._sceneNumber == 1) { + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(314, 132)); setAction(&_action6); } else { @@ -888,7 +903,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager1, this, 4001, &_globals->_player, NULL); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setAction(&_sequenceManager2, NULL, 4002, &_hotspot7, NULL); + _miranda.setAction(&_sequenceManager2, NULL, 4002, &_miranda, NULL); } if (_globals->getFlag(42)) @@ -898,13 +913,13 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { break; case 4010: - _hotspot7.setPosition(Common::Point(-210, 139)); + _miranda.setPosition(Common::Point(-210, 139)); - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(314, 132)); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(314, 132)); _hotspot2.postInit(); _hotspot2.setVisage(4018); @@ -917,25 +932,25 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { break; case 4025: - if (_globals->_inventory._ladder._sceneNumber != 4000) + if (RING_INVENTORY._ladder._sceneNumber == 4000) _hotspot8.remove(); _globals->_player.setPosition(Common::Point(260, 185)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); if (_globals->getFlag(96)) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(290, 163)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(290, 163)); } if (_globals->_stripNum == 4025) { _soundHandler1.startSound(182); - _hotspot11.remove(); + _forceField.remove(); _hotspot5.postInit(); _hotspot5.setVisage(2801); @@ -947,15 +962,15 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); if (!_globals->getFlag(96)) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(195, 128)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(195, 128)); Common::Point pt(268, 157); PlayerMover *mover = new PlayerMover(); - _hotspot4.addMover(mover, &pt, NULL); + _olo.addMover(mover, &pt, NULL); } _sceneMode = 4003; @@ -963,7 +978,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { } else if (_globals->getFlag(96)) { _globals->_player.disableControl(); _sceneMode = 4013; - setAction(&_sequenceManager1, this, 4013, &_hotspot4, NULL); + setAction(&_sequenceManager1, this, 4013, &_olo, NULL); } _globals->clearFlag(96); @@ -972,7 +987,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { case 4045: _globals->_player.enableControl(); - if (_globals->_inventory._ladder._sceneNumber != 4000) { + if (RING_INVENTORY._ladder._sceneNumber != 4000) { _hotspot8.postInit(); _hotspot8.setVisage(4017); _hotspot8.animate(ANIM_MODE_1, NULL); @@ -982,16 +997,16 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(208, 153)); if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); if (_globals->getFlag(39)) { _globals->clearFlag(39); - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.animate(ANIM_MODE_1, NULL); - _hotspot4.setObjectWrapper(new SceneObjectWrapper()); - _hotspot4.setPosition(Common::Point(219, 150)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.animate(ANIM_MODE_1, NULL); + _olo.setObjectWrapper(new SceneObjectWrapper()); + _olo.setPosition(Common::Point(219, 150)); _globals->_player.disableControl(); setAction(&_sequenceManager1, this, 4010, &_globals->_player, NULL); @@ -1000,12 +1015,12 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { if (_globals->_stripNum == 4000) { _globals->_stripNum = 0; - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.animate(ANIM_MODE_1, NULL); - _hotspot9.setObjectWrapper(new SceneObjectWrapper()); - _hotspot9.setPosition(Common::Point(231, 159)); - _hotspot9.setStrip(4); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.animate(ANIM_MODE_1, NULL); + _guardRock.setObjectWrapper(new SceneObjectWrapper()); + _guardRock.setPosition(Common::Point(231, 159)); + _guardRock.setStrip(4); setAction(&_action12); } @@ -1019,7 +1034,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(4008); _globals->_player.setStrip(4); _globals->_player.setFrame(_globals->_player.getFrameCount()); - _globals->_player.setPriority2(16); + _globals->_player.fixPriority(16); _globals->_player.setPosition(Common::Point(260, 55)); _sceneMode = 4007; @@ -1029,7 +1044,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); } - if (_globals->_inventory._ladder._sceneNumber != 4000) + if (RING_INVENTORY._ladder._sceneNumber != 4000) _hotspot8.remove(); break; @@ -1037,7 +1052,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _globals->_player.enableControl(); _globals->_player.setPosition(Common::Point(270, 155)); - if (_globals->getFlag(42) && (_globals->_inventory._ladder._sceneNumber != 4000)) { + if (_globals->getFlag(42) && (RING_INVENTORY._ladder._sceneNumber != 4000)) { _hotspot8.setVisage(4017); _hotspot8.animate(ANIM_MODE_1, NULL); _hotspot8.setPosition(Common::Point(244, 151)); @@ -1045,42 +1060,42 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { } if (!_globals->getFlag(36) && !_globals->getFlag(43)) - _hotspot7.setPosition(Common::Point(246, 146)); + _miranda.setPosition(Common::Point(246, 146)); break; default: _globals->_soundHandler.startSound(155); - _hotspot3.postInit(); - _hotspot3.setVisage(4002); - _hotspot3._moveDiff = Common::Point(10, 10); - _hotspot3.setPosition(Common::Point(-100, 80)); - _hotspot3.changeZoom(-1); - _hotspot3.setPosition(Common::Point(130, -1)); - _hotspot3.animate(ANIM_MODE_2, NULL); + _lander.postInit(); + _lander.setVisage(4002); + _lander._moveDiff = Common::Point(10, 10); + _lander.setPosition(Common::Point(-100, 80)); + _lander.changeZoom(-1); + _lander.setPosition(Common::Point(130, -1)); + _lander.animate(ANIM_MODE_2, NULL); if (_globals->_stripNum == 9000) { - _hotspot4.postInit(); - _hotspot4.setVisage(4006); - _hotspot4.setPosition(Common::Point(235, 153)); + _olo.postInit(); + _olo.setVisage(4006); + _olo.setPosition(Common::Point(235, 153)); - _hotspot9.postInit(); - _hotspot9.setVisage(4001); - _hotspot9.setStrip(3); - _hotspot9.setPosition(Common::Point(255, 153)); + _guardRock.postInit(); + _guardRock.setVisage(4001); + _guardRock.setStrip(3); + _guardRock.setPosition(Common::Point(255, 153)); setAction(&_action11); - _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_inventory._rope._sceneNumber = 4150; + RING_INVENTORY._ladder._sceneNumber = 4100; + RING_INVENTORY._rope._sceneNumber = 4150; _soundHandler1.startSound(156); - _hotspot11.postInit(); - _hotspot11.setVisage(4000); - _hotspot11.setStrip(4); - _hotspot11.setPosition(Common::Point(312, 174)); - _hotspot11.setPriority2(200); - _hotspot11.animate(ANIM_MODE_8, 0, NULL); + _forceField.postInit(); + _forceField.setVisage(4000); + _forceField.setStrip(4); + _forceField.setPosition(Common::Point(312, 174)); + _forceField.fixPriority(200); + _forceField.animate(ANIM_MODE_8, 0, NULL); } else { if (!_globals->getFlag(37)) { _hotspot2.postInit(); @@ -1090,32 +1105,32 @@ void Scene4000::postInit(SceneObjectList *OwnerList) { _hotspot2.setPosition(Common::Point(182, 146)); _hotspot2.setAction(&_action10); } - - _hotspot7.setPosition(Common::Point(-210, 139)); + _miranda.setPosition(Common::Point(-210, 139)); setAction(&_action13); } + break; } - if (_globals->_inventory._ladder._sceneNumber == 4000) { - _hotspot10.postInit(); - _hotspot10.setVisage(4000); - _hotspot10.setStrip(5); - _hotspot10.setPosition(Common::Point(245, 147)); + if (RING_INVENTORY._ladder._sceneNumber == 4000) { + _ladder.postInit(); + _ladder.setVisage(4000); + _ladder.setStrip(5); + _ladder.setPosition(Common::Point(245, 147)); - _globals->_sceneItems.push_back(&_hotspot10); + _globals->_sceneItems.push_back(&_ladder); } - if (_globals->_inventory._rope._sceneNumber == 4000) { - _hotspot6.postInit(); - _hotspot6.setVisage(4000); - _hotspot6.setStrip(7); - _hotspot6.setPriority2(1); - _hotspot6.setPosition(Common::Point(268, 44)); + if (RING_INVENTORY._rope._sceneNumber == 4000) { + _rope.postInit(); + _rope.setVisage(4000); + _rope.setStrip(7); + _rope.fixPriority(1); + _rope.setPosition(Common::Point(268, 44)); } _globals->_sceneItems.addItems(&_hotspot8, &_hotspot17, &_hotspot18, &_hotspot14, &_hotspot15, - &_hotspot16, &_hotspot12, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23, + &_hotspot16, &_theTech, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23, &_hotspot24, &_hotspot25, &_hotspot19, &_hotspot26, NULL); } @@ -1132,9 +1147,10 @@ void Scene4000::signal() { setAction(&_sequenceManager1, this, 4014, &_globals->_player, &_hotspot5, NULL); break; case 4004: - _globals->_inventory._ladder._sceneNumber = 4000; + RING_INVENTORY._ladder._sceneNumber = 4000; // Deliberate fall-through case 4007: + _globals->_player._uiEnabled = true; _globals->_events.setCursor(CURSOR_USE); _globals->setFlag(40); break; @@ -1154,21 +1170,21 @@ void Scene4000::signal() { break; case 4010: _globals->setFlag(38); - _hotspot4.remove(); + _olo.remove(); break; case 4012: - _globals->_player.checkAngle(&_hotspot12); + _globals->_player.checkAngle(&_theTech); _globals->_sceneManager.changeScene(4025); break; case 4013: _globals->_player.enableControl(); - _hotspot4.remove(); + _olo.remove(); break; case 4014: _globals->_sceneManager.changeScene(4250); break; case 4015: - ADD_MOVER_NULL(_hotspot7, 0, _hotspot7._position.y - 5); + ADD_MOVER_NULL(_miranda, 0, _miranda._position.y - 5); break; } } @@ -1177,38 +1193,38 @@ void Scene4000::dispatch() { Scene::dispatch(); if ((_globals->_player.getRegionIndex() == 10) || (_globals->_player.getRegionIndex() == 6)) - _globals->_player.setPriority2(200); + _globals->_player.fixPriority(200); if (_globals->_player.getRegionIndex() == 11) - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); if (_globals->_player.getRegionIndex() == 5) - _globals->_player.setPriority2(94); + _globals->_player.fixPriority(94); if (_globals->_sceneObjects->contains(&_hotspot5)) { if ((_hotspot5.getRegionIndex() == 10) || (_hotspot5.getRegionIndex() == 6)) - _hotspot5.setPriority2(200); + _hotspot5.fixPriority(200); if (_hotspot5.getRegionIndex() == 11) - _hotspot5.setPriority2(-1); + _hotspot5.fixPriority(-1); if (_hotspot5.getRegionIndex() == 5) - _hotspot5.setPriority2(94); + _hotspot5.fixPriority(94); } - if (_globals->_sceneObjects->contains(&_hotspot7)) { - if (!_hotspot7._mover) - _hotspot7.checkAngle(&_globals->_player); + if (_globals->_sceneObjects->contains(&_miranda)) { + if (!_miranda._mover) + _miranda.checkAngle(&_globals->_player); if (!_action && _globals->_player.getRegionIndex() == 23) { - ADD_MOVER_NULL(_hotspot7, 204, 186); + ADD_MOVER_NULL(_miranda, 204, 186); } - if ((_hotspot7.getRegionIndex() == 10) || (_hotspot7.getRegionIndex() == 6)) - _hotspot7.setPriority2(200); - if (_hotspot7.getRegionIndex() == 11) - _hotspot7.setPriority2(-1); - if (_hotspot7.getRegionIndex() == 5) - _hotspot7.setPriority2(94); + if ((_miranda.getRegionIndex() == 10) || (_miranda.getRegionIndex() == 6)) + _miranda.fixPriority(200); + if (_miranda.getRegionIndex() == 11) + _miranda.fixPriority(-1); + if (_miranda.getRegionIndex() == 5) + _miranda.fixPriority(94); } if (!_action) { - if ((_globals->_inventory._peg._sceneNumber == 1) && _globals->getFlag(34) && + if ((RING_INVENTORY._peg._sceneNumber == 1) && _globals->getFlag(34) && _globals->getFlag(37) && !_globals->getFlag(40)) { _globals->_player.disableControl(); _soundHandler1.startSound(177); @@ -1222,16 +1238,16 @@ void Scene4000::dispatch() { if (_globals->_player.getRegionIndex() == 15) _globals->_sceneManager.changeScene(4100); - if ((_globals->_player._position.x > 5) && (_globals->_player._position.y < 100)) { + if ((_globals->_player._position.x <= 5) && (_globals->_player._position.y < 100)) { _globals->_player.disableControl(); - if (!_globals->_sceneObjects->contains(&_hotspot7) || (_hotspot7._position.y <= 100)) { + if (!_globals->_sceneObjects->contains(&_miranda) || (_miranda._position.y <= 100)) { _sceneMode = 4008; setAction(&_sequenceManager1, this, 4008, &_globals->_player, NULL); } else { _sceneMode = 4015; _globals->_player.addMover(NULL); - setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_hotspot7, NULL); + setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_miranda, NULL); } } } @@ -1398,8 +1414,8 @@ void Scene4025::Action3::signal() { /*--------------------------------------------------------------------------*/ -void Scene4025::Hole::synchronise(Serialiser &s) { - SceneObject::synchronise(s); +void Scene4025::Hole::synchronize(Serializer &s) { + SceneObject::synchronize(s); SYNC_POINTER(_pegPtr); s.syncAsSint16LE(_armStrip); s.syncAsSint16LE(_newPosition.x); @@ -1426,7 +1442,7 @@ void Scene4025::Hole::doAction(int action) { if (!scene->_pegPtr2) { _globals->_player.disableControl(); _globals->_events.setCursor(CURSOR_USE); - _globals->_inventory._peg._sceneNumber = 4025; + RING_INVENTORY._peg._sceneNumber = 4025; scene->_pegPtr = &scene->_peg5; scene->_holePtr = this; @@ -1442,8 +1458,8 @@ void Scene4025::Hole::doAction(int action) { } } -void Scene4025::Peg::synchronise(Serialiser &s) { - SceneObject::synchronise(s); +void Scene4025::Peg::synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsSint16LE(_field88); SYNC_POINTER(_armStrip); } @@ -1513,6 +1529,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { _peg5.setFrame(5); _peg5.hide(); + // Hole N-W _hole1.postInit(); _hole1.setVisage(4025); _hole1.setStrip(1); @@ -1522,6 +1539,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { _hole1._newPosition = Common::Point(123, 44); _hole1._armStrip = 8; + // Hole N-E _hole2.postInit(); _hole2.setVisage(4025); _hole2.setStrip(1); @@ -1531,6 +1549,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { _hole2._newPosition = Common::Point(166, 44); _hole2._armStrip = 7; + // Hole Center _hole3.postInit(); _hole3.setVisage(4025); _hole3.setStrip(1); @@ -1540,15 +1559,17 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { _hole3._newPosition = Common::Point(145, 60); _hole3._armStrip = 6; + // Hole S-W _hole4.postInit(); _hole4.setVisage(4025); _hole4.setStrip(1); - _hole4.setFrame2(6); + _hole4.setFrame2(9); _hole4.setPosition(Common::Point(123, 87)); _hole4._pegPtr = NULL; _hole4._newPosition = Common::Point(123, 80); _hole4._armStrip = 5; + // Hole S-E _hole5.postInit(); _hole5.setVisage(4025); _hole5.setStrip(1); @@ -1558,11 +1579,11 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { _hole5._newPosition = Common::Point(166, 80); _hole5._armStrip = 4; - _hole1.setPriority2(1); - _hole2.setPriority2(1); - _hole3.setPriority2(1); - _hole4.setPriority2(1); - _hole5.setPriority2(1); + _hole1.fixPriority(1); + _hole2.fixPriority(1); + _hole3.fixPriority(1); + _hole4.fixPriority(1); + _hole5.fixPriority(1); _armHotspot.postInit(); _armHotspot.setVisage(4025); @@ -1578,8 +1599,8 @@ void Scene4025::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 4026, NULL); } -void Scene4025::synchronise(Serialiser &s) { - Scene::synchronise(s); +void Scene4025::synchronize(Serializer &s) { + Scene::synchronize(s); SYNC_POINTER(_pegPtr); SYNC_POINTER(_pegPtr2); SYNC_POINTER(_holePtr); @@ -1594,7 +1615,7 @@ void Scene4025::signal() { if (_sceneMode != 4027) { if (_sceneMode != 4028) { _gfxButton.setText(EXIT_MSG); - _gfxButton._bounds.centre(144, 107); + _gfxButton._bounds.center(144, 107); _gfxButton.draw(); _gfxButton._bounds.expandPanes(); } @@ -1609,8 +1630,8 @@ void Scene4025::process(Event &event) { Scene::process(event); if (_gfxButton.process(event)) { - if (_globals->_inventory._peg._sceneNumber == 4025) - _globals->_inventory._peg._sceneNumber = 1; + if (RING_INVENTORY._peg._sceneNumber == 4025) + RING_INVENTORY._peg._sceneNumber = 1; _globals->_sceneManager.changeScene(4000); } @@ -1642,7 +1663,7 @@ void Scene4045::Action1::signal() { scene->_stripManager.start(4040, this, scene); break; case 2: - scene->_hotspot5.animate(ANIM_MODE_NONE, NULL); + scene->_olloFace.animate(ANIM_MODE_NONE, NULL); scene->_hotspot4.animate(ANIM_MODE_5, this); break; case 3: @@ -1674,7 +1695,7 @@ void Scene4045::Action2::signal() { scene->_stripManager.start(_globals->_stripNum, this, scene); break; case 2: - scene->_hotspot5.animate(ANIM_MODE_NONE, NULL); + scene->_olloFace.animate(ANIM_MODE_NONE, NULL); setDelay(10); break; case 3: @@ -1705,7 +1726,7 @@ void Scene4045::Action3::signal() { break; case 2: scene->_hotspot4.animate(ANIM_MODE_6, NULL); - scene->_hotspot5.animate(ANIM_MODE_NONE, NULL); + scene->_olloFace.animate(ANIM_MODE_NONE, NULL); ADD_MOVER(_globals->_player, 91, 1264); break; case 3: @@ -1717,7 +1738,7 @@ void Scene4045::Action3::signal() { /*--------------------------------------------------------------------------*/ -void Scene4045::Hotspot1::doAction(int action) { +void Scene4045::OlloStand::doAction(int action) { Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene; switch (action) { @@ -1733,7 +1754,7 @@ void Scene4045::Hotspot1::doAction(int action) { case CURSOR_TALK: if (_strip == 5) { setStrip(6); - animate(ANIM_MODE_NONE, 0); + animate(ANIM_MODE_NONE, NULL); } if (_globals->_player._position.y < 135) { scene->_sceneMode = 4046; @@ -1759,7 +1780,7 @@ void Scene4045::Hotspot1::doAction(int action) { } } -void Scene4045::Hotspot2::doAction(int action) { +void Scene4045::Miranda::doAction(int action) { Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene; switch (action) { @@ -1777,7 +1798,7 @@ void Scene4045::Hotspot2::doAction(int action) { } } -void Scene4045::Hotspot6::doAction(int action) { +void Scene4045::Necklace::doAction(int action) { Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene; switch (action) { @@ -1787,13 +1808,13 @@ void Scene4045::Hotspot6::doAction(int action) { case CURSOR_USE: if (_globals->_player._position.y < 135) { SceneItem::display2(4045, 16); - _globals->_inventory._peg._sceneNumber = 1; + RING_INVENTORY._peg._sceneNumber = 1; _globals->_events.setCursor(CURSOR_WALK); remove(); } else { scene->_sceneMode = 4047; _globals->_player.disableControl(); - scene->setAction(&scene->_sequenceManager, scene, 4047, &_globals->_player, &scene->_hotspot1, NULL); + scene->setAction(&scene->_sequenceManager, scene, 4047, &_globals->_player, &scene->_olloStand, NULL); } break; default: @@ -1805,15 +1826,15 @@ void Scene4045::Hotspot6::doAction(int action) { /*--------------------------------------------------------------------------*/ Scene4045::Scene4045() : - _hotspot3(0, CURSOR_LOOK, 4045, 1, CURSOR_USE, 4100, 21, LIST_END), - _hotspot7(9, CURSOR_LOOK, 4045, 0, CURSOR_USE, 4045, 15, LIST_END), - _hotspot8(10, CURSOR_LOOK, 4045, 2, LIST_END), - _hotspot9(11, CURSOR_LOOK, 4045, 3, CURSOR_USE, 4045, 15, LIST_END), - _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4045, 19, LIST_END), - _hotspot11(13, CURSOR_LOOK, 4045, 6, CURSOR_USE, 4045, 15, LIST_END), - _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4045, 29, LIST_END), - _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4045, 19, LIST_END), - _hotspot14(0, CURSOR_LOOK, 4045, 10, LIST_END) { + _flame(0, CURSOR_LOOK, 4045, 1, CURSOR_USE, 4100, 21, LIST_END), + _hotspot7(9, CURSOR_LOOK, 4045, 0, CURSOR_USE, 4045, 15, LIST_END), + _hotspot8(10, CURSOR_LOOK, 4045, 2, LIST_END), + _hotspot9(11, CURSOR_LOOK, 4045, 3, CURSOR_USE, 4045, 15, LIST_END), + _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4045, 19, LIST_END), + _hotspot11(13, CURSOR_LOOK, 4045, 6, CURSOR_USE, 4045, 15, LIST_END), + _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4045, 29, LIST_END), + _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4045, 19, LIST_END), + _hotspot14(0, CURSOR_LOOK, 4045, 10, LIST_END) { _hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); } @@ -1833,12 +1854,12 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { _speakerQText._textPos.y = 140; - _hotspot3.postInit(); - _hotspot3.setVisage(4045); - _hotspot3.setPosition(Common::Point(47, 111)); - _hotspot3.animate(ANIM_MODE_2, NULL); - _hotspot3.setPriority2(156); - _globals->_sceneItems.push_back(&_hotspot3); + _flame.postInit(); + _flame.setVisage(4045); + _flame.setPosition(Common::Point(47, 111)); + _flame.animate(ANIM_MODE_2, NULL); + _flame.fixPriority(156); + _globals->_sceneItems.push_back(&_flame); _globals->_player.postInit(); _globals->_player.setVisage(4200); @@ -1846,73 +1867,76 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player._moveDiff = Common::Point(7, 4); - _hotspot1.postInit(); - _hotspot1.setVisage(4051); + _olloStand.postInit(); + _olloStand.setVisage(4051); - _hotspot5.postInit(); - _hotspot5.setVisage(4051); - _hotspot5.setStrip(4); - _hotspot5.setPriority2(152); + _olloFace.postInit(); + _olloFace.setVisage(4051); + _olloFace.setStrip(4); + _olloFace.fixPriority(152); if(_globals->_sceneManager._previousScene == 4050) { _globals->_soundHandler.startSound(155); _globals->_player.setPosition(Common::Point(72, 128)); _globals->_player.enableControl(); - _hotspot1.setStrip(5); - _hotspot1.setPosition(Common::Point(173, 99)); - _hotspot1._numFrames = 1; - _hotspot1.animate(ANIM_MODE_2, NULL); + _olloStand.setStrip(5); + _olloStand.setPosition(Common::Point(173, 99)); + _olloStand._numFrames = 1; + _olloStand.animate(ANIM_MODE_2, NULL); - _hotspot5.setPosition(Common::Point(177, 40)); + _olloFace.setPosition(Common::Point(177, 40)); - if (_globals->_inventory._peg._sceneNumber == 4045) { - _hotspot6.postInit(); - _hotspot6.setVisage(4045); - _hotspot6.setStrip(2); - _hotspot6.setPosition(Common::Point(108, 82)); - _globals->_sceneItems.push_back(&_hotspot6); + if (RING_INVENTORY._peg._sceneNumber == 4045) { + _necklace.postInit(); + _necklace.setVisage(4045); + _necklace.setStrip(2); + _necklace.setPosition(Common::Point(108, 82)); + _globals->_sceneItems.push_back(&_necklace); } } else { _globals->_player.setPosition(Common::Point(108, 192)); _globals->_player.setStrip(4); if (!_globals->getFlag(36) && !_globals->getFlag(43)) { - _hotspot2.postInit(); - _hotspot2.setVisage(4102); - _hotspot2.animate(ANIM_MODE_NONE, NULL); - _hotspot2.setStrip(3); - _hotspot2.changeZoom(-1); - _hotspot2.setPosition(Common::Point(66, 209)); - _globals->_sceneItems.push_back(&_hotspot2); + _miranda.postInit(); + _miranda.setVisage(4102); + _miranda.animate(ANIM_MODE_NONE, NULL); + _miranda.setStrip(3); + _miranda.setFrame(2); + _miranda.changeZoom(-1); + + _miranda.setPosition(Common::Point(66, 209)); + _globals->_sceneItems.push_back(&_miranda); } if (_globals->getFlag(31)) { - _hotspot1.setVisage(4051); - _hotspot1.setStrip(5); - _hotspot1.setPosition(Common::Point(173, 99)); - _hotspot1._numFrames = 1; - _hotspot1.animate(ANIM_MODE_2, NULL); - - _hotspot5.setPosition(Common::Point(177, 40)); - - if (_globals->_inventory._peg._sceneNumber == 4045) { - _hotspot6.postInit(); - _hotspot6.setVisage(4045); - _hotspot6.setStrip(2); - _hotspot6.setPosition(Common::Point(108, 82)); - _globals->_sceneItems.push_back(&_hotspot6); + // Olo asleep + _olloStand.setVisage(4051); + _olloStand.setStrip(5); + _olloStand.setPosition(Common::Point(173, 99)); + _olloStand._numFrames = 1; + _olloStand.animate(ANIM_MODE_2, NULL); + + _olloFace.setPosition(Common::Point(177, 40)); + + if (RING_INVENTORY._peg._sceneNumber == 4045) { + _necklace.postInit(); + _necklace.setVisage(4045); + _necklace.setStrip(2); + _necklace.setPosition(Common::Point(108, 82)); + _globals->_sceneItems.push_back(&_necklace); } } else { - _hotspot1.setPosition(Common::Point(186, 149)); + _olloStand.setPosition(Common::Point(186, 149)); _hotspot4.postInit(); _hotspot4.setVisage(4051); _hotspot4.setStrip(2); - _hotspot4.setPriority2(152); + _hotspot4.fixPriority(152); _hotspot4.setPosition(Common::Point(202, 80)); - _hotspot5.setPosition(Common::Point(192, 77)); + _olloFace.setPosition(Common::Point(192, 77)); _globals->setFlag(31); setAction(&_action1); @@ -1920,17 +1944,17 @@ void Scene4045::postInit(SceneObjectList *OwnerList) { } } - _globals->_sceneItems.addItems(&_hotspot1, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10, + _globals->_sceneItems.addItems(&_olloStand, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10, &_hotspot13, &_hotspot11, &_hotspot12, &_hotspot14, NULL); } void Scene4045::stripCallback(int v) { switch (v) { case 1: - _hotspot5.animate(ANIM_MODE_7, 0, NULL); + _olloFace.animate(ANIM_MODE_7, 0, NULL); break; case 2: - _hotspot5.animate(ANIM_MODE_NONE, NULL); + _olloFace.animate(ANIM_MODE_NONE, NULL); break; } } @@ -1939,7 +1963,7 @@ void Scene4045::signal() { switch (_sceneMode) { case 4046: case 4047: - _hotspot5.animate(ANIM_MODE_NONE, NULL); + _olloFace.animate(ANIM_MODE_NONE, NULL); break; case 4050: _globals->_sceneManager.changeScene(4000); @@ -1954,11 +1978,11 @@ void Scene4045::dispatch() { if (!_action) { if (_globals->_player.getRegionIndex() == 8) { _globals->_player.addMover(NULL); - if (_hotspot1._strip == 1) { + if (_olloStand._strip != 1) { _globals->_player.disableControl(); _sceneMode = 4046; - _hotspot1._numFrames = 10; - setAction(&_sequenceManager, this, 4046, &_globals->_player, &_hotspot1, NULL); + _olloStand._numFrames = 10; + setAction(&_sequenceManager, this, 4046, &_globals->_player, &_olloStand, NULL); } else { setAction(&_action3); } @@ -1982,6 +2006,7 @@ void Scene4045::dispatch() { *--------------------------------------------------------------------------*/ void Scene4050::Action1::signal() { + // "Map" on the wall Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -1989,9 +2014,12 @@ void Scene4050::Action1::signal() { _globals->_player.disableControl(); setDelay(3); break; - case 1: - ADD_PLAYER_MOVER(204, 152); + case 1: { + Common::Point pt(204, 152); + PlayerMover *mover = new PlayerMover(); + _globals->_player.addMover(mover, &pt, this); break; + } case 2: _globals->_player.checkAngle(&scene->_hotspot17); @@ -1999,7 +2027,8 @@ void Scene4050::Action1::signal() { scene->_hotspot14.setVisage(4050); scene->_hotspot14.setStrip(2); scene->_hotspot14.setPosition(Common::Point(91, 154)); - scene->_hotspot14.setPriority2(200); + scene->_hotspot14.fixPriority(200); + setDelay(10); break; case 3: _globals->_events.waitForPress(); @@ -2013,6 +2042,7 @@ void Scene4050::Action1::signal() { } void Scene4050::Action2::signal() { + // Climb down the rope switch (_actionIndex++) { case 0: _globals->_player.disableControl(); @@ -2041,21 +2071,21 @@ void Scene4050::Action2::signal() { _globals->_player.setVisage(4202); _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.setPosition(Common::Point(210, 185)); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.enableControl(); - remove(); break; } } void Scene4050::Action3::signal() { + // Climb up the rope switch (_actionIndex++) { case 0: ADD_PLAYER_MOVER(210, 185); break; case 1: - _globals->_player.setPriority2(200); + _globals->_player.fixPriority(200); _globals->_player.setVisage(4052); _globals->_player.setStrip(5); _globals->_player.changeZoom(100); @@ -2084,7 +2114,7 @@ void Scene4050::Action4::signal() { case 0: _globals->_player.disableControl(); ADD_MOVER(_globals->_player, 189, 135); - _globals->_player.setPriority2(200); + _globals->_player.fixPriority(200); break; case 1: _globals->_player._moveDiff.y = 3; @@ -2120,7 +2150,7 @@ void Scene4050::Action4::signal() { _globals->_player.setStrip(2); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(216, 184)); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); break; case 5: scene->_hotspot16.setStrip2(4); @@ -2149,7 +2179,7 @@ void Scene4050::Action4::signal() { /*--------------------------------------------------------------------------*/ -void Scene4050::Hotspot14::doAction(int action) { +void Scene4050::Hotspot15::doAction(int action) { Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene; switch (action) { @@ -2214,6 +2244,7 @@ void Scene4050::postInit(SceneObjectList *OwnerList) { switch (_globals->_sceneManager._previousScene) { case 4000: if (_globals->getFlag(41)) { + // Using a rope _hotspot15.postInit(); _hotspot15.setVisage(4054); _hotspot15.setPosition(Common::Point(206, 103)); @@ -2222,12 +2253,13 @@ void Scene4050::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(4008); _globals->_player.setPosition(Common::Point(206, 62)); _globals->_player.changeZoom(130); - _globals->_player.setPriority2(200); + _globals->_player.fixPriority(200); _globals->_player.setStrip(2); setAction(&_action2); _globals->_soundHandler.startSound(175); } else { + // Without the rope _globals->_player.setVisage(5315); _globals->_player.setPosition(Common::Point(189, 83)); _globals->_player.changeZoom(130); @@ -2264,7 +2296,7 @@ void Scene4050::postInit(SceneObjectList *OwnerList) { _hotspot17.postInit(); _hotspot17.setVisage(4050); _hotspot17.setPosition(Common::Point(209, 119)); - _hotspot17.setPriority2(2); + _hotspot17.fixPriority(2); _hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); _hotspot2.setBounds(Rect(150, 25, 198, 125)); @@ -2285,11 +2317,22 @@ void Scene4050::postInit(SceneObjectList *OwnerList) { } void Scene4050::signal() { - + if (_sceneMode == 4050) + _globals->_sceneManager.changeScene(4045); } void Scene4050::dispatch() { + if (!_action) { + if ((_globals->_player._canWalk) && (_globals->_player._position.y > 196)) { + _sceneMode = 4050; + _globals->_player.disableControl(); + Common::Point pt(160, 275); + NpcMover *mover = new NpcMover(); + _globals->_player.addMover(mover, &pt, this); + } + } + Scene::dispatch(); } /*-------------------------------------------------------------------------- @@ -2328,7 +2371,7 @@ void Scene4100::Action2::signal() { scene->_hotspot2.setVisage(4120); scene->_hotspot2.animate(ANIM_MODE_1, NULL); scene->_hotspot2.setStrip2(4); - scene->_hotspot2.setPriority2(100); + scene->_hotspot2.fixPriority(100); scene->_hotspot2.setPosition(Common::Point(214, 119)); setDelay(3); @@ -2355,14 +2398,15 @@ void Scene4100::Action3::signal() { switch (_actionIndex++) { case 0: _globals->clearFlag(43); - _globals->clearFlag(36); + _globals->setFlag(36); setDelay(15); break; case 1: scene->_stripManager.start(4505, this); break; case 2: - scene->setAction(&scene->_action2); + setAction(&scene->_action2, this); + break; case 3: scene->_stripManager.start(4510, this); break; @@ -2372,10 +2416,13 @@ void Scene4100::Action3::signal() { case 5: _globals->_sceneManager.changeScene(4150); break; + default: + break; } } void Scene4100::Action4::signal() { + // Rock getting drunk Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -2394,6 +2441,7 @@ void Scene4100::Action4::signal() { _globals->clearFlag(43); _globals->setFlag(42); scene->_stripManager.start(4119, this); + break; case 4: setDelay(15); break; @@ -2413,16 +2461,16 @@ void Scene4100::Action5::signal() { ADD_PLAYER_MOVER(58, 151); break; case 1: - if (_globals->_inventory._ladder._sceneNumber == 4100) { - _globals->_inventory._ladder._sceneNumber = 1; - scene->_hotspot6.remove(); + if (RING_INVENTORY._ladder._sceneNumber == 4100) { + RING_INVENTORY._ladder._sceneNumber = 1; + scene->_ladder.remove(); } else { - scene->_hotspot6.postInit(); - scene->_hotspot6.setVisage(4101); - scene->_hotspot6.setPosition(Common::Point(49, 144)); + scene->_ladder.postInit(); + scene->_ladder.setVisage(4101); + scene->_ladder.setPosition(Common::Point(49, 144)); - _globals->_inventory._ladder._sceneNumber = 4100; - _globals->_sceneItems.push_front(&scene->_hotspot6); + RING_INVENTORY._ladder._sceneNumber = 4100; + _globals->_sceneItems.push_front(&scene->_ladder); } _globals->_player.enableControl(); @@ -2454,20 +2502,26 @@ void Scene4100::Hotspot1::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { - case CURSOR_LOOK: - SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12); - break; case OBJECT_STUNNER: SceneItem::display2(4100, 16); break; + case OBJECT_ALE: + _globals->_player.disableControl(); + scene->setAction(&scene->_action3); + break; + case CURSOR_LOOK: + SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12); + break; case CURSOR_USE: SceneItem::display2(4100, 22); break; case CURSOR_TALK: - if (_globals->_inventory._peg._sceneNumber == 1) { + if (RING_INVENTORY._peg._sceneNumber == 1) { _globals->_player.disableControl(); + scene->_sceneMode = 4109; scene->setAction(&scene->_sequenceManager, scene, 4109, NULL); } else if (_globals->getFlag(42)) { + scene->_sceneMode = 4102; scene->setAction(&scene->_sequenceManager, scene, 4102, NULL); } else { if (_globals->getFlag(33)) @@ -2500,7 +2554,7 @@ void Scene4100::Hotspot2::doAction(int action) { } } -void Scene4100::Hotspot5::doAction(int action) { +void Scene4100::Miranda::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { @@ -2517,7 +2571,7 @@ void Scene4100::Hotspot5::doAction(int action) { } } -void Scene4100::Hotspot6::doAction(int action) { +void Scene4100::Ladder::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; switch (action) { @@ -2539,7 +2593,9 @@ void Scene4100::Hotspot6::doAction(int action) { } } - +/** + Exit hotspot, South + */ void Scene4100::Hotspot14::doAction(int action) { Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene; @@ -2595,13 +2651,13 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _hotspot1.postInit(); _hotspot1.setVisage(4102); - _hotspot1.setPriority2(129); + _hotspot1.fixPriority(129); _hotspot1.setPosition(Common::Point(171, 120)); _hotspot3.postInit(); _hotspot3.setVisage(4130); _hotspot3.animate(ANIM_MODE_2, NULL); - _hotspot3.setPriority2(200); + _hotspot3.fixPriority(200); _hotspot3.setPosition(Common::Point(272, 110)); _hotspot4.postInit(); @@ -2615,21 +2671,21 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _hotspot1.setStrip(1); _hotspot1.setFrame(4); } else if (!_globals->getFlag(43)) { - _hotspot5.postInit(); - _hotspot5.setVisage(4102); - _hotspot5.setStrip2(3); - _hotspot5.setFrame(2); - _hotspot5.setPosition(Common::Point(65, 188)); + _miranda.postInit(); + _miranda.setVisage(4102); + _miranda.setStrip2(3); + _miranda.setFrame(2); + _miranda.setPosition(Common::Point(65, 188)); - _globals->_sceneItems.push_back(&_hotspot5); + _globals->_sceneItems.push_back(&_miranda); } - if (_globals->_inventory._ladder._sceneNumber == 4100) { - _hotspot6.postInit(); - _hotspot6.setVisage(4101); - _hotspot6.setPosition(Common::Point(49, 144)); + if (RING_INVENTORY._ladder._sceneNumber == 4100) { + _ladder.postInit(); + _ladder.setVisage(4101); + _ladder.setPosition(Common::Point(49, 144)); - _globals->_sceneItems.push_back(&_hotspot6); + _globals->_sceneItems.push_back(&_ladder); } _hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); @@ -2664,7 +2720,7 @@ void Scene4100::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(252, 139)); _globals->_player.setStrip(2); } else { - if ((_globals->_inventory._ale._sceneNumber == 4100) && !_globals->getFlag(42)) { + if ((RING_INVENTORY._ale._sceneNumber == 4100) && !_globals->getFlag(42)) { _globals->_player.disableControl(); setAction(&_action3); } @@ -2838,15 +2894,15 @@ void Scene4150::Action3::signal() { case 1: _globals->_player.checkAngle(&scene->_hotspot3); - if (_globals->_inventory._rope._sceneNumber == 1) { + if (RING_INVENTORY._rope._sceneNumber == 1) { scene->_hotspot3.postInit(); scene->_hotspot3.setVisage(4150); scene->_hotspot3.setPosition(Common::Point(175, 70)); - _globals->_inventory._rope._sceneNumber = 4150; + RING_INVENTORY._rope._sceneNumber = 4150; _globals->_sceneItems.push_front(&scene->_hotspot3); } else { - _globals->_inventory._rope._sceneNumber = 1; + RING_INVENTORY._rope._sceneNumber = 1; scene->_hotspot3.remove(); } @@ -2914,7 +2970,7 @@ void Scene4150::Hotspot3::doAction(int action) { /*--------------------------------------------------------------------------*/ Scene4150::Scene4150() : - _hotspot1(0, CURSOR_LOOK, 4000, 17, CURSOR_USE, 4150, 21, CURSOR_TALK, 4150, 21, + _hotspot1(0, CURSOR_LOOK, 4150, 17, CURSOR_USE, 4150, 21, CURSOR_TALK, 4150, 21, OBJECT_SCANNER, 4150, 22, OBJECT_STUNNER, 4150, 23, LIST_END), _hotspot2(0, CURSOR_LOOK, 4150, 4, CURSOR_USE, 4150, 24, LIST_END), _hotspot7(0, CURSOR_LOOK, 4150, 1, CURSOR_USE, 4150, 25, OBJECT_ROPE, 4150, 26, LIST_END), @@ -2947,7 +3003,7 @@ void Scene4150::postInit(SceneObjectList *OwnerList) { _hotspot2.postInit(); _hotspot2.setVisage(4171); _hotspot2.animate(ANIM_MODE_2, NULL); - _hotspot2.setPriority2(100); + _hotspot2.fixPriority(100); _hotspot2.setPosition(Common::Point(76, 147)); _hotspot1.postInit(); @@ -2980,7 +3036,7 @@ void Scene4150::postInit(SceneObjectList *OwnerList) { _globals->setFlag(44); } - if (_globals->_inventory._rope._sceneNumber == 4150) { + if (RING_INVENTORY._rope._sceneNumber == 4150) { _hotspot3.postInit(); _hotspot3.setVisage(4150); _hotspot3.setPosition(Common::Point(175, 70)); @@ -3071,7 +3127,7 @@ void Scene4250::Action1::signal() { break; case 5: ADD_PLAYER_MOVER(220, 175); - scene->_hotspot1.setPriority2(105); + scene->_hotspot1.fixPriority(105); ADD_PLAYER_MOVER_NULL(scene->_hotspot1, 197, 173); break; case 6: @@ -3167,7 +3223,7 @@ void Scene4250::Action4::signal() { break; case 1: _globals->_player.addMover(NULL); - scene->_stripManager.start((_globals->_inventory._helmet._sceneNumber == 4250) ? 4259 : 4256, this); + scene->_stripManager.start((RING_INVENTORY._helmet._sceneNumber == 4250) ? 4259 : 4256, this); break; case 2: ADD_PLAYER_MOVER(_globals->_player._position.x + 5, _globals->_player._position.y); @@ -3188,8 +3244,8 @@ void Scene4250::Action5::signal() { setDelay(3); break; case 1: - scene->_hotspot4.setPriority2(195); - scene->_hotspot1.setPriority2(105); + scene->_hotspot4.fixPriority(195); + scene->_hotspot1.fixPriority(105); ADD_MOVER_NULL(_globals->_player, 6, 185); ADD_MOVER_NULL(scene->_hotspot4, 9, 190); ADD_MOVER(scene->_hotspot1, 12, 180); @@ -3200,7 +3256,7 @@ void Scene4250::Action5::signal() { ADD_PLAYER_MOVER_NULL(scene->_hotspot4, 239, 195); break; case 3: - scene->_hotspot4.setPriority2(-1); + scene->_hotspot4.fixPriority(-1); scene->_hotspot1.setStrip(5); scene->_hotspot4.setStrip(7); _globals->_player.enableControl(); @@ -3216,7 +3272,7 @@ void Scene4250::Hotspot1::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 19 : 14); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 19 : 14); break; case CURSOR_TALK: _globals->_player.disableControl(); @@ -3224,7 +3280,7 @@ void Scene4250::Hotspot1::doAction(int action) { scene->setAction(&scene->_action3); } else { scene->_sceneMode = 4260; - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { scene->_sceneMode = 4265; scene->setAction(&scene->_sequenceManager, scene, 4265, this, NULL); } else { @@ -3234,13 +3290,13 @@ void Scene4250::Hotspot1::doAction(int action) { } break; case OBJECT_SCANNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 21); else SceneHotspot::doAction(action); break; case OBJECT_STUNNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 22); else SceneHotspot::doAction(action); @@ -3252,6 +3308,7 @@ void Scene4250::Hotspot1::doAction(int action) { } void Scene4250::Hotspot2::doAction(int action) { + //Ship with stasis field Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene; switch (action) { @@ -3285,16 +3342,16 @@ void Scene4250::Hotspot4::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 18 : 5); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 18 : 5); break; case OBJECT_SCANNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 21); else SceneHotspot::doAction(action); break; case OBJECT_STUNNER: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) SceneItem::display2(4250, 22); else SceneHotspot::doAction(action); @@ -3307,12 +3364,12 @@ void Scene4250::Hotspot4::doAction(int action) { } else { scene->_sceneMode = 4254; - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { scene->_sceneMode = 4266; scene->setAction(&scene->_sequenceManager, scene, 4266, this, NULL); } else { scene->setAction(&scene->_sequenceManager, scene, - (_globals->_inventory._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL); + (RING_INVENTORY._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL); } } break; @@ -3327,32 +3384,33 @@ void Scene4250::Hotspot6::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 7 : 6); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 7 : 6); break; case OBJECT_SCANNER: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 1 : 2); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 1 : 2); break; case OBJECT_STUNNER: - SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 20 : 3); + SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 20 : 3); break; case OBJECT_HELMET: _globals->_soundHandler.startSound(354); _globals->_player.disableControl(); - _globals->_inventory._helmet._sceneNumber = 4250; + RING_INVENTORY._helmet._sceneNumber = 4250; - if (_globals->_inventory._concentrator._sceneNumber == 1) { + if (RING_INVENTORY._concentrator._sceneNumber == 1) { if (_globals->getFlag(115)) { scene->_sceneMode = 4269; scene->setAction(&scene->_sequenceManager, scene, 4269, this, NULL); } else { _globals->setFlag(115); _globals->_events.setCursor(CURSOR_WALK); + scene->_sceneMode = 4256; scene->setAction(&scene->_sequenceManager, scene, 4256, this, NULL); } - } else if (_globals->_inventory._keyDevice._sceneNumber == 1) { + } else if (RING_INVENTORY._keyDevice._sceneNumber == 1) { scene->_sceneMode = 4267; scene->setAction(&scene->_sequenceManager, scene, 4267, this, NULL); - } else if (_globals->_inventory._keyDevice._sceneNumber == 4300) { + } else if (RING_INVENTORY._keyDevice._sceneNumber == 4300) { scene->_sceneMode = 4268; scene->setAction(&scene->_sequenceManager, scene, 4268, this, NULL); } else { @@ -3363,10 +3421,10 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case OBJECT_NULLIFIER: - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { _globals->_soundHandler.startSound(353); _globals->_player.disableControl(); - _globals->_inventory._helmet._sceneNumber = 1; + RING_INVENTORY._helmet._sceneNumber = 1; scene->_sceneMode = 4257; scene->setAction(&scene->_sequenceManager, scene, 4257, &_globals->_player, this, NULL); @@ -3375,7 +3433,7 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case CURSOR_TALK: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) doAction(OBJECT_HELMET); else { _globals->_player.disableControl(); @@ -3384,11 +3442,11 @@ void Scene4250::Hotspot6::doAction(int action) { } break; case CURSOR_USE: - if (_globals->_inventory._helmet._sceneNumber == 4250) + if (RING_INVENTORY._helmet._sceneNumber == 4250) doAction(OBJECT_HELMET); else { _globals->_player.disableControl(); - if ((_globals->_inventory._items._sceneNumber != 1) || (_globals->_inventory._concentrator._sceneNumber != 1)) { + if ((RING_INVENTORY._items._sceneNumber != 1) || (RING_INVENTORY._concentrator._sceneNumber != 1)) { scene->_sceneMode = 4258; scene->setAction(&scene->_sequenceManager, scene, 4258, this, NULL); } else { @@ -3427,7 +3485,7 @@ void Scene4250::Hotspot8::doAction(int action) { _globals->_player.disableControl(); scene->_sceneMode = 4270; scene->setAction(&scene->_sequenceManager, scene, - (_globals->_inventory._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL); + (RING_INVENTORY._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL); break; default: SceneHotspot::doAction(action); @@ -3482,7 +3540,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _hotspot5.postInit(); _hotspot5.setVisage(4250); _hotspot5.setPosition(Common::Point(268, 168)); - _hotspot5.setPriority2(1); + _hotspot5.fixPriority(1); _hotspot4.postInit(); _hotspot4.setVisage(2701); @@ -3497,7 +3555,6 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _hotspot1.setPosition(Common::Point(197, 173)); _hotspot1.changeZoom(70); - _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setPosition(Common::Point(252, 176)); _globals->_player.changeZoom(70); @@ -3506,10 +3563,10 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _hotspot6.setStrip(4); _hotspot6.setFrame(3); _hotspot6.changeZoom(50); - _hotspot6.setPriority2(70); + _hotspot6.fixPriority(70); _hotspot6.setPosition(Common::Point(261, 175)); - if (_globals->_inventory._helmet._sceneNumber == 4250) { + if (RING_INVENTORY._helmet._sceneNumber == 4250) { _hotspot6.setStrip(6); _hotspot6.setFrame(_hotspot6.getFrameCount()); } @@ -3529,7 +3586,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _sceneMode = 4253; _globals->_sceneItems.push_front(&_hotspot6); - setAction(&_sequenceManager, this, 4253, &_globals->_player, NULL); + setAction(&_sequenceManager, this, 4253, &_globals->_player, &_hotspot6, &_hotspot4, NULL); } } } else if (_globals->_stripNum == 9000) { @@ -3563,7 +3620,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) { _hotspot2.postInit(); _hotspot2.setVisage(4251); _hotspot2.setStrip2(1); - _hotspot2.setPriority2(2); + _hotspot2.fixPriority(2); _hotspot2.setFrame(1); _hotspot2.setPosition(Common::Point(267, 172)); @@ -3583,6 +3640,7 @@ void Scene4250::signal() { break; case 4253: if (_globals->_stripNum == 4301) { + _sceneMode = 4261; ADD_MOVER_NULL(_hotspot1, 241, 169); setAction(&_sequenceManager, this, 4261, &_globals->_player, &_hotspot6, NULL); } else { @@ -3603,18 +3661,19 @@ void Scene4250::signal() { case 4270: _globals->_player.enableControl(); break; - case 4255: - case 4262: - case 4263: - break; case 4259: _globals->_soundHandler.startSound(360); _globals->_sceneManager.changeScene(9900); break; case 4261: - _globals->_inventory._keyDevice._sceneNumber = 1; + RING_INVENTORY._keyDevice._sceneNumber = 1; _globals->_player.enableControl(); break; + case 4255: + case 4262: + case 4263: + default: + break; } } @@ -3625,7 +3684,7 @@ void Scene4250::dispatch() { _globals->_player.changeZoom(70); if (_globals->_player.getRegionIndex() == 15) { _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); } if (_hotspot1.getRegionIndex() == 8) @@ -3634,7 +3693,7 @@ void Scene4250::dispatch() { _hotspot1.changeZoom(70); if (_hotspot1.getRegionIndex() == 15) { _hotspot1.changeZoom(-1); - _hotspot1.setPriority2(-1); + _hotspot1.fixPriority(-1); } if (_hotspot4.getRegionIndex() == 8) @@ -3643,7 +3702,7 @@ void Scene4250::dispatch() { _hotspot4.changeZoom(70); if (_hotspot4.getRegionIndex() == 15) { _hotspot4.changeZoom(-1); - _hotspot4.setPriority2(-1); + _hotspot4.fixPriority(-1); } Scene::dispatch(); @@ -3705,7 +3764,7 @@ void Scene4300::Action1::signal() { setDelay(60); break; case 7: - scene->_hotspot10.setPriority2(250); + scene->_hotspot10.fixPriority(250); scene->_hotspot10.animate(ANIM_MODE_5, this); break; case 8: @@ -3758,7 +3817,7 @@ void Scene4300::Hotspot8::doAction(int action) { SceneItem::display2(4300, 19); break; case OBJECT_KEY_DEVICE: - _globals->_inventory._keyDevice._sceneNumber = 4300; + RING_INVENTORY._keyDevice._sceneNumber = 4300; _globals->_scenePalette.addRotation(240, 254, -1); animate(ANIM_MODE_5, NULL); @@ -3774,15 +3833,15 @@ void Scene4300::Hotspot8::doAction(int action) { void Scene4300::Hotspot9::doAction(int action) { switch (action) { case CURSOR_LOOK: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) SceneItem::display2(4300, 7); else SceneItem::display2(4300, 1); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) SceneItem::display2(4300, 7); else SceneItem::display2(4300, 3); @@ -3791,8 +3850,8 @@ void Scene4300::Hotspot9::doAction(int action) { SceneItem::display2(4300, 24); break; case OBJECT_SCANNER: - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber != 1)) + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber != 1)) SceneItem::display2(4300, 22); else SceneItem::display2(4300, 23); @@ -3804,6 +3863,7 @@ void Scene4300::Hotspot9::doAction(int action) { } void Scene4300::Hotspot10::doAction(int action) { + // Alien Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene; switch (action) { @@ -3838,8 +3898,8 @@ void Scene4300::Hotspot15::signal() { scene->_soundHandler2.startSound(345); _strip = (_globals->_randomSource.getRandomNumber(6) < 2) ? 2 : 1; - if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) || - (_globals->_inventory._concentrator._sceneNumber == 1)) { + if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) || + (RING_INVENTORY._concentrator._sceneNumber == 1)) { setStrip(1); setFrame(1); animate(ANIM_MODE_NONE, NULL); @@ -3856,8 +3916,8 @@ void Scene4300::Hotspot16::doAction(int action) { SceneItem::display2(4300, 8); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) && - (_globals->_inventory._concentrator._sceneNumber != 4300)) { + if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) && + (RING_INVENTORY._concentrator._sceneNumber != 4300)) { SceneItem::display2(4300, 16); } else { scene->_sceneMode = 4302; @@ -3881,17 +3941,17 @@ void Scene4300::Hotspot17::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(4300, (_globals->_inventory._stasisBox2._sceneNumber == 4300) ? 17 : 11); + SceneItem::display2(4300, (RING_INVENTORY._stasisBox2._sceneNumber == 4300) ? 17 : 11); break; case CURSOR_USE: - if (_globals->_inventory._stasisBox2._sceneNumber != 4300) + if (RING_INVENTORY._stasisBox2._sceneNumber != 4300) SceneItem::display2(4300, 13); else { _globals->_scenePalette.clearListeners(); remove(); SceneItem::display2(4300, 12); - _globals->_inventory._concentrator._sceneNumber = 1; + RING_INVENTORY._concentrator._sceneNumber = 1; } break; case OBJECT_SCANNER: @@ -3922,8 +3982,8 @@ void Scene4300::Hotspot19::doAction(int action) { SceneItem::display2(4300, 24); break; case CURSOR_USE: - if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) && - (_globals->_inventory._concentrator._sceneNumber != 4300)) + if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) && + (RING_INVENTORY._concentrator._sceneNumber != 4300)) SceneItem::display2(4300, 10); else SceneItem::display2(4300, 29); @@ -3955,7 +4015,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot7.postInit(); _hotspot7.setPosition(Common::Point(90, 128)); _hotspot7.setVisage(4303); - _hotspot7.setPriority2(250); + _hotspot7.fixPriority(250); _globals->_sceneItems.push_back(&_hotspot7); _hotspot9.setup(120, 49, 174, 91, 4300, -1, -1); @@ -3973,14 +4033,14 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.push_back(&_hotspot8); } - if (_globals->_inventory._concentrator._sceneNumber == 4300) { + if (RING_INVENTORY._concentrator._sceneNumber == 4300) { _hotspot17.postInit(); _hotspot17.setVisage(4300); _hotspot17.setStrip(6); - _hotspot17.setPriority2(1); + _hotspot17.fixPriority(1); _hotspot17.setPosition(Common::Point(200, 69)); - if (_globals->_inventory._stasisBox2._sceneNumber == 4300) + if (RING_INVENTORY._stasisBox2._sceneNumber == 4300) _hotspot17.setFrame(_hotspot17.getFrameCount()); _globals->_sceneItems.push_back(&_hotspot17); @@ -3990,14 +4050,14 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot10.postInit(); _hotspot10.setVisage(4302); _hotspot10.setPosition(Common::Point(244, 179)); - _hotspot10.setPriority2(100); + _hotspot10.fixPriority(100); _globals->_sceneItems.push_back(&_hotspot10); _hotspot12.postInit(); _hotspot12.setVisage(4302); _hotspot12.setStrip2(3); _hotspot12.setPosition(Common::Point(231, 185)); - _hotspot12.setPriority2(251); + _hotspot12.fixPriority(251); _hotspot12.hide(); _hotspot13.postInit(); @@ -4005,16 +4065,16 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot13.setVisage(4302); _hotspot13.setStrip2(2); _hotspot13.setPosition(Common::Point(256, 168)); - _hotspot13.setPriority2(251); + _hotspot13.fixPriority(251); _hotspot13._numFrames = 1; _hotspot13.animate(ANIM_MODE_8, 0, NULL); } - if (_globals->_inventory._items._sceneNumber == 4300) { + if (RING_INVENTORY._items._sceneNumber == 4300) { _hotspot16.postInit(); _hotspot16.setVisage(4300); _hotspot16.setPosition(Common::Point(169, 141)); - _hotspot16.setPriority2(1); + _hotspot16.fixPriority(1); _hotspot16.setStrip(4); _globals->_sceneItems.push_back(&_hotspot16); } @@ -4025,37 +4085,37 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot1.postInit(); _hotspot1.setVisage(4301); - _hotspot1.setPriority2(145); + _hotspot1.fixPriority(145); _hotspot1.setPosition(Common::Point(160, 64)); _hotspot2.postInit(); _hotspot2.setVisage(4301); _hotspot2.setStrip2(2); - _hotspot2.setPriority2(140); + _hotspot2.fixPriority(140); _hotspot2.setPosition(Common::Point(166, 90)); _hotspot3.postInit(); _hotspot3.setVisage(4301); _hotspot3.setStrip2(3); - _hotspot3.setPriority2(135); + _hotspot3.fixPriority(135); _hotspot3.setPosition(Common::Point(173, 114)); _hotspot4.postInit(); _hotspot4.setVisage(4301); _hotspot4.setStrip2(4); - _hotspot4.setPriority2(130); + _hotspot4.fixPriority(130); _hotspot4.setPosition(Common::Point(187, 141)); _hotspot5.postInit(); _hotspot5.setVisage(4301); _hotspot5.setStrip2(5); - _hotspot5.setPriority2(125); + _hotspot5.fixPriority(125); _hotspot5.setPosition(Common::Point(201, 164)); _hotspot6.postInit(); _hotspot6.setVisage(4301); _hotspot6.setStrip2(6); - _hotspot6.setPriority2(120); + _hotspot6.fixPriority(120); _hotspot6.setPosition(Common::Point(219, 186)); setAction(&_action1); @@ -4091,12 +4151,12 @@ void Scene4300::remove() { void Scene4300::signal() { switch (_sceneMode) { case 4302: - _globals->_inventory._items._sceneNumber = 1; + RING_INVENTORY._items._sceneNumber = 1; _hotspot16.remove(); _globals->_player.enableControl(); break; case 4303: - _globals->_inventory._stasisBox2._sceneNumber = 4300; + RING_INVENTORY._stasisBox2._sceneNumber = 4300; _hotspot15.setStrip(1); _hotspot15.setFrame(1); _hotspot15.animate(ANIM_MODE_NONE, NULL); @@ -4108,7 +4168,7 @@ void Scene4300::signal() { _hotspot14.setPosition(Common::Point(60, 199)); _gfxButton.setText(EXIT_MSG); - _gfxButton._bounds.centre(60, 193); + _gfxButton._bounds.center(60, 193); _gfxButton.draw(); _gfxButton._bounds.expandPanes(); @@ -4134,8 +4194,8 @@ void Scene4300::process(Event &event) { * *--------------------------------------------------------------------------*/ -void Scene4301::Action1::synchronise(Serialiser &s) { - Action::synchronise(s); +void Scene4301::Action1::synchronize(Serializer &s) { + Action::synchronize(s); s.syncAsSint16LE(_field34E); for (int idx = 0; idx < 6; ++idx) s.syncAsSint16LE(_indexList[idx]); @@ -4172,14 +4232,14 @@ void Scene4301::Action1::signal() { scene->_hotspot2.setStrip(2); scene->_hotspot2.setFrame(1); scene->_hotspot2.setPosition(Common::Point(30, 15)); - scene->_hotspot2.setPriority2(255); + scene->_hotspot2.fixPriority(255); scene->_hotspot3.postInit(); scene->_hotspot3.setVisage(4303); scene->_hotspot3.setStrip(2); scene->_hotspot3.setFrame(2); scene->_hotspot3.setPosition(Common::Point(48, 29)); - scene->_hotspot3.setPriority2(255); + scene->_hotspot3.fixPriority(255); scene->_hotspot3.hide(); _field34E = 0; @@ -4187,6 +4247,7 @@ void Scene4301::Action1::signal() { _actionIndex = 2; break; case 10: + // Puzzle: Wrong code _globals->_events.setCursor(CURSOR_NONE); scene->_soundHandler.startSound(337); if (scene->_hotspot3._flags & OBJFLAG_HIDE) @@ -4211,6 +4272,7 @@ void Scene4301::Action1::signal() { _globals->_events.setCursor(CURSOR_USE); break; case 20: + // Puzzle: Correct code _globals->_player.disableControl(); scene->_soundHandler.startSound(339); scene->_hotspot3._frame = 3; @@ -4233,6 +4295,7 @@ void Scene4301::Action1::signal() { } void Scene4301::Action1::process(Event &event) { + // Puzzle Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene; Rect buttonsRect; @@ -4255,7 +4318,7 @@ void Scene4301::Action1::process(Event &event) { _buttonList[_state].setStrip(buttonIndex + 3); _buttonList[_state].setFrame(1); _buttonList[_state].setPosition(Common::Point((_state % 3) * 25 + 55, (_state / 3) * 25 + 121)); - _buttonList[_state].setPriority2(255); + _buttonList[_state].fixPriority(255); _buttonList[_state]._numFrames = 25; _buttonList[_state].animate(ANIM_MODE_5, NULL); @@ -4287,6 +4350,7 @@ void Scene4301::Action1::process(Event &event) { /*--------------------------------------------------------------------------*/ void Scene4301::Hotspot4::doAction(int action) { + // Hatch near door Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene; if (action == CURSOR_USE) { @@ -4303,7 +4367,7 @@ void Scene4301::Hotspot5::doAction(int action) { SceneItem::display2(4300, 0); break; case CURSOR_USE: - SceneItem::display(4300, 30); + SceneItem::display2(4300, 30); break; case OBJECT_SCANNER: SceneItem::display2(4300, 31); @@ -4326,15 +4390,15 @@ void Scene4301::postInit(SceneObjectList *OwnerList) { setZoomPercents(0, 100, 200, 100); _field68E = false; - _globals->_inventory._stasisBox2._sceneNumber = 1; - _hotspot4.setup(76, 97, 102, 127, 4300, 5, 6); + RING_INVENTORY._stasisBox2._sceneNumber = 1; + _hotspot4.setup(97, 76, 127, 102, 4300, 5, 6); _hotspot1.postInit(); _hotspot1.setPosition(Common::Point(90, 128)); _hotspot1.setVisage(4303); _hotspot1._strip = 1; _hotspot1._frame = 1; - _hotspot1.setPriority2(250); + _hotspot1.fixPriority(250); _hotspot5.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); _globals->_sceneItems.push_back(&_hotspot5); diff --git a/engines/tsage/ringworld_scenes5.h b/engines/tsage/ringworld_scenes5.h index 0def49ebe6..6c44395f9c 100644 --- a/engines/tsage/ringworld_scenes5.h +++ b/engines/tsage/ringworld_scenes5.h @@ -89,7 +89,7 @@ class Scene4000 : public Scene { }; /* Hotspots */ - class Hotspot7 : public SceneObject { + class Miranda : public SceneObject { public: virtual void doAction(int action); }; @@ -97,21 +97,21 @@ class Scene4000 : public Scene { private: int _ctr; public: - virtual void synchronise(Serialiser &s) { - SceneObject::synchronise(s); + virtual void synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsUint16LE(_ctr); } virtual void doAction(int action); }; - class Hotspot9 : public SceneObject { + class GuardRock : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot10 : public SceneObject { + class Ladder : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot12 : public SceneObject { + class TheTech : public SceneObject { public: virtual void doAction(int action); }; @@ -151,13 +151,13 @@ public: SpeakerCHFR _speakerCHFR; SpeakerQL _speakerQL; SpeakerCHFText _speakerCHFText; - SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5, _hotspot6; - Hotspot7 _hotspot7; + SceneObject _smoke1, _hotspot2, _lander, _olo, _hotspot5, _rope; + Miranda _miranda; Hotspot8 _hotspot8; - Hotspot9 _hotspot9; - Hotspot10 _hotspot10; - DisplayHotspot _hotspot11; - Hotspot12 _hotspot12; + GuardRock _guardRock; + Ladder _ladder; + DisplayHotspot _forceField; + TheTech _theTech; Hotspot13 _hotspot13; Hotspot _hotspot14, _hotspot15, _hotspot16; Hotspot17 _hotspot17; @@ -165,7 +165,7 @@ public: DisplayHotspot _hotspot19, _hotspot20, _hotspot21, _hotspot22; Hotspot23 _hotspot23; DisplayHotspot _hotspot24, _hotspot25, _hotspot26; - SceneObject _hotspot27; + SceneObject _smoke2; Action1 _action1; Action2 _action2; Action3 _action3; @@ -208,7 +208,7 @@ class Scene4025 : public Scene { int _armStrip; Common::Point _newPosition; - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void doAction(int action); }; class Peg : public SceneObject { @@ -217,7 +217,7 @@ class Scene4025 : public Scene { int _armStrip; Peg() : SceneObject() { _field88 = 0; _armStrip = 3; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void doAction(int action); }; @@ -248,7 +248,7 @@ public: Scene4025(); virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); virtual void process(Event &event); @@ -271,15 +271,15 @@ class Scene4045 : public Scene { }; /* Hotspots */ - class Hotspot1 : public SceneObject { + class OlloStand : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot2 : public SceneObject { + class Miranda : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot6 : public SceneObject { + class Necklace : public SceneObject { public: virtual void doAction(int action); }; @@ -292,11 +292,11 @@ public: SpeakerPText _speakerPText; SpeakerQText _speakerQText; SpeakerQL _speakerQL; - Hotspot1 _hotspot1; - Hotspot2 _hotspot2; - DisplayHotspot _hotspot3; - SceneObject _hotspot4, _hotspot5; - Hotspot6 _hotspot6; + OlloStand _olloStand; + Miranda _miranda; + DisplayHotspot _flame; + SceneObject _hotspot4, _olloFace; + Necklace _necklace; DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13, _hotspot14; Action1 _action1; @@ -330,7 +330,7 @@ class Scene4050 : public Scene { }; /* Hotspots */ - class Hotspot14 : public SceneObject { + class Hotspot15 : public SceneObject { public: virtual void doAction(int action); }; @@ -349,8 +349,9 @@ public: DisplayHotspot _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5; DisplayHotspot _hotspot6, _hotspot7, _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13; - Hotspot14 _hotspot14; - SceneObject _hotspot15, _hotspot16; + SceneObject _hotspot14; + Hotspot15 _hotspot15; + SceneObject _hotspot16; Hotspot17 _hotspot17; Scene4050(); @@ -395,11 +396,11 @@ class Scene4100 : public Scene { public: virtual void doAction(int action); }; - class Hotspot5 : public SceneObject { + class Miranda : public SceneObject { public: virtual void doAction(int action); }; - class Hotspot6 : public SceneObject { + class Ladder : public SceneObject { public: virtual void doAction(int action); }; @@ -425,8 +426,8 @@ public: Hotspot1 _hotspot1; Hotspot2 _hotspot2; DisplayHotspot _hotspot3, _hotspot4; - Hotspot5 _hotspot5; - Hotspot6 _hotspot6; + Miranda _miranda; + Ladder _ladder; DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10; DisplayHotspot _hotspot11, _hotspot12, _hotspot13; Hotspot14 _hotspot14; @@ -655,7 +656,7 @@ class Scene4301 : public Scene { int _field34E; int _indexList[6]; - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); virtual void process(Event &event); @@ -683,8 +684,8 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void dispatch(); - virtual void synchronise(Serialiser &s) { - Scene::synchronise(s); + virtual void synchronize(Serializer &s) { + Scene::synchronize(s); s.syncAsSint16LE(_field68E); } }; diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp index 3ea4d7b279..973104a952 100644 --- a/engines/tsage/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld_scenes6.cpp @@ -36,6 +36,7 @@ namespace tSage { *--------------------------------------------------------------------------*/ void Scene5000::Action1::signal() { + // Ship landing Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -127,7 +128,7 @@ void Scene5000::Action2::signal() { case 2: if (!_globals->getFlag(59)) setAction(&scene->_action3, this); - _globals->_player.setPriority2(15); + _globals->_player.fixPriority(15); ADD_MOVER(_globals->_player, 208, 100); break; case 3: @@ -145,7 +146,7 @@ void Scene5000::Action2::signal() { break; case 7: _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(35); + _globals->_player.fixPriority(35); ADD_MOVER(_globals->_player, 201, 166); break; case 8: @@ -154,7 +155,7 @@ void Scene5000::Action2::signal() { break; case 9: _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(50); + _globals->_player.fixPriority(50); ADD_MOVER(_globals->_player, 220, 182); break; case 10: @@ -164,7 +165,7 @@ void Scene5000::Action2::signal() { case 11: _globals->_player.changeZoom(-1); _globals->_player.setStrip2(-1); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); ADD_MOVER(_globals->_player, 208, 175); break; case 12: @@ -200,7 +201,7 @@ void Scene5000::Action3::signal() { scene->_hotspot7.setPosition(Common::Point(217, 76)); scene->_hotspot7.changeZoom(10); scene->_hotspot7.setStrip2(3); - scene->_hotspot7.setPriority2(200); + scene->_hotspot7.fixPriority(200); scene->_hotspot7._moveDiff.y = 2; scene->_hotspot7.animate(ANIM_MODE_1, NULL); ADD_MOVER(scene->_hotspot7, 214, 89); @@ -209,14 +210,14 @@ void Scene5000::Action3::signal() { break; case 2: scene->_hotspot7.changeZoom(-1); - scene->_hotspot7.setPriority2(14); + scene->_hotspot7.fixPriority(14); ADD_MOVER(scene->_hotspot7, 208, 100); break; case 3: ADD_MOVER(scene->_hotspot7, 213, 98); break; case 4: - scene->_hotspot7.setPriority2(19); + scene->_hotspot7.fixPriority(19); ADD_MOVER(scene->_hotspot7, 213, 98); break; case 5: @@ -228,7 +229,7 @@ void Scene5000::Action3::signal() { break; case 7: scene->_hotspot7.changeZoom(-1); - scene->_hotspot7.setPriority2(34); + scene->_hotspot7.fixPriority(34); ADD_MOVER(scene->_hotspot7, 201, 166); break; case 8: @@ -237,7 +238,7 @@ void Scene5000::Action3::signal() { break; case 9: scene->_hotspot7.changeZoom(-1); - scene->_hotspot7.setPriority2(49); + scene->_hotspot7.fixPriority(49); ADD_MOVER(scene->_hotspot7, 210, 182); break; case 10: @@ -247,7 +248,7 @@ void Scene5000::Action3::signal() { case 11: scene->_hotspot7.changeZoom(-1); scene->_hotspot7.setStrip2(-1); - scene->_hotspot7.setPriority2(-1); + scene->_hotspot7.fixPriority(-1); ADD_MOVER(scene->_hotspot7, 175, 166); break; case 12: @@ -268,7 +269,7 @@ void Scene5000::Action4::signal() { setDelay(1); break; case 1: - _globals->_player.setPriority2(50); + _globals->_player.fixPriority(50); _globals->_player.setStrip2(4); ADD_MOVER(_globals->_player, 210, 182); break; @@ -276,14 +277,14 @@ void Scene5000::Action4::signal() { ADD_MOVER(_globals->_player, 205, 146); break; case 3: - _globals->_player.setPriority2(35); + _globals->_player.fixPriority(35); ADD_MOVER(_globals->_player, 201, 166); break; case 4: ADD_MOVER(_globals->_player, 229, 115); break; case 5: - _globals->_player.setPriority2(20); + _globals->_player.fixPriority(20); _globals->_player.changeZoom(47); ADD_MOVER(_globals->_player, 220, 125); break; @@ -295,7 +296,7 @@ void Scene5000::Action4::signal() { ADD_MOVER(_globals->_player, 213, 98); break; case 8: - _globals->_player.setPriority2(15); + _globals->_player.fixPriority(15); ADD_MOVER(_globals->_player, 208, 100); break; case 9: @@ -345,6 +346,7 @@ void Scene5000::Action5::signal() { } void Scene5000::Action6::signal() { + // Discussion between the hero and Seeker, then the hero goes back to the lander Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -364,7 +366,7 @@ void Scene5000::Action6::signal() { ADD_PLAYER_MOVER(208, 163); break; case 4: - _globals->_player.setPriority2(50); + _globals->_player.fixPriority(50); _globals->_player.setStrip2(4); ADD_MOVER(_globals->_player, 210, 182); break; @@ -384,7 +386,7 @@ void Scene5000::Hotspot7::doAction(int action) { SceneItem::display2(5000, 12); break; case CURSOR_TALK: - setAction(&scene->_action6); + scene->setAction(&scene->_action6); break; default: SceneHotspot::doAction(action); @@ -393,6 +395,7 @@ void Scene5000::Hotspot7::doAction(int action) { } void Scene5000::Hotspot8::doAction(int action) { + // Cave Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene; switch (action) { @@ -403,7 +406,7 @@ void Scene5000::Hotspot8::doAction(int action) { SceneItem::display2(5000, 14); break; case OBJECT_SCANNER: - setAction(&scene->_action5); + scene->setAction(&scene->_action5); break; default: SceneHotspot::doAction(action); @@ -455,14 +458,14 @@ void Scene5000::postInit(SceneObjectList *OwnerList) { _hotspot1.setVisage(5001); _hotspot1.setFrame2(1); _hotspot1._moveDiff = Common::Point(5, 5); - _hotspot1.setPriority2(10); + _hotspot1.fixPriority(10); _hotspot1.changeZoom(10); _hotspot4.postInit(); _hotspot4.setVisage(5001); _hotspot4.setStrip2(2); _hotspot4._moveDiff = Common::Point(5, 1); - _hotspot4.setPriority2(10); + _hotspot4.fixPriority(10); _hotspot4.changeZoom(100); _hotspot4.animate(ANIM_MODE_8, 0, NULL); _hotspot4.hide(); @@ -484,13 +487,13 @@ void Scene5000::postInit(SceneObjectList *OwnerList) { _hotspot5.setVisage(5001); _hotspot5.setStrip2(4); _hotspot5._numFrames = 5; - _hotspot5.setPriority2(15); + _hotspot5.fixPriority(15); _hotspot5.setPosition(Common::Point(218, 76)); _hotspot5.hide(); _hotspot9.postInit(); _hotspot9.setVisage(5002); - _hotspot9.setPriority2(80); + _hotspot9.fixPriority(80); _hotspot9.setPosition(Common::Point(71, 174)); _hotspot10.postInit(); @@ -512,7 +515,7 @@ void Scene5000::postInit(SceneObjectList *OwnerList) { _hotspot13.setBounds(Rect(0, 164, 135, 200)); _hotspot14.setBounds(Rect(0, 0, 105, 140)); _hotspot15.setBounds(Rect(266, 70, 291, 85)); - _hotspot16.setBounds(Rect(0, 86, 3219, 200)); + _hotspot16.setBounds(Rect(0, 86, 319, 200)); _hotspot12.setBounds(Rect(230, 143, 244, 150)); _globals->_sceneItems.addItems(&_hotspot9, &_hotspot10, &_hotspot11, &_hotspot8, &_hotspot13, @@ -644,7 +647,7 @@ void Scene5100::Action1::signal() { scene->_hotspot5.setPosition(Common::Point(1160, 34)); scene->_hotspot5.setStrip2(2); scene->_hotspot5.animate(ANIM_MODE_1, NULL); - scene->_hotspot5.setPriority2(10); + scene->_hotspot5.fixPriority(10); _globals->_sceneItems.push_front(&scene->_hotspot5); ADD_MOVER(scene->_hotspot5, 999, 14); @@ -689,9 +692,9 @@ void Scene5100::Action2::signal() { break; case 3: if (_globals->_player._position.x >= 966) { - ADD_PLAYER_MOVER(1215, 155); + ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 1215, 155); } else { - ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 966, 185); + ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 966, 185); } if (_globals->_player._position.x >= 966) { @@ -701,7 +704,7 @@ void Scene5100::Action2::signal() { } break; case 4: - ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 1215, 155); + ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 1215, 155); ADD_PLAYER_MOVER(1215, 155); break; case 5: @@ -829,6 +832,7 @@ void Scene5100::Action5::signal() { /*--------------------------------------------------------------------------*/ void Scene5100::HotspotGroup1::doAction(int action) { + // Flesh Eaters Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (action) { @@ -881,11 +885,12 @@ void Scene5100::Hotspot4::doAction(int action) { } void Scene5100::HotspotGroup2::doAction(int action) { + // Bat Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (action) { case CURSOR_LOOK: - SceneItem::display2(5100, _globals->getFlag(62) ? 47 : 23); + SceneItem::display2(5100, _globals->getFlag(108) ? 47 : 23); break; case CURSOR_USE: SceneItem::display2(5100, 29); @@ -909,6 +914,7 @@ void Scene5100::HotspotGroup2::doAction(int action) { } void Scene5100::Hotspot9::doAction(int action) { + // Rope Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (action) { @@ -929,7 +935,7 @@ void Scene5100::Hotspot9::doAction(int action) { case OBJECT_BONE: _globals->_player.disableControl(); scene->_sceneMode = 5116; - scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, &scene->_hotspot10, + scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, this, &scene->_hotspot10, &scene->_hotspot4, NULL); break; default: @@ -1004,6 +1010,7 @@ void Scene5100::Hotspot18::doAction(int action) { } void Scene5100::Hotspot19::doAction(int action) { + // Pillar Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene; switch (action) { @@ -1082,14 +1089,14 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _hotspot14.postInit(); _hotspot14.setVisage(5101); _hotspot14.setPosition(Common::Point(498, 147)); - _hotspot14.setPriority2(200); + _hotspot14.fixPriority(200); _hotspot14._moveDiff.y = 10; } _hotspot17.postInit(); _hotspot17.setVisage(5101); _hotspot17._strip = 2; - _hotspot17.setPriority2(200); + _hotspot17.fixPriority(200); if (_globals->getFlag(67)) _hotspot17.setPosition(Common::Point(554, 192)); @@ -1158,7 +1165,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { } } - if (_globals->getFlag(60) && (_globals->_inventory._stasisBox._sceneNumber == 1) && + if (_globals->getFlag(60) && (RING_INVENTORY._stasisBox._sceneNumber == 1) && _globals->getFlag(107) && _globals->getFlag(67)) { _hotspot8.postInit(); _hotspot8.setVisage(2806); @@ -1178,7 +1185,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { case 5200: if (_globals->_stripNum == 5200) { _globals->_player.setVisage(5101); - _globals->_player.setPriority2(200); + _globals->_player.fixPriority(200); _globals->_player.setStrip(5); _globals->_player.setFrame(1); _globals->_player.setPosition(Common::Point(513, 199)); @@ -1227,7 +1234,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _globals->_player.setVisage(5101); _globals->_player.setStrip(6); - _globals->_player.setPriority2(170); + _globals->_player.fixPriority(170); _globals->_player.setPosition(Common::Point(1168, 110)); setAction(&_sequenceManager, this, 5111, &_globals->_player, NULL); @@ -1256,11 +1263,11 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _hotspot6.setStrip(6); _hotspot6.setFrame(1); _globals->_sceneItems.push_back(&_hotspot6); - } else if (_globals->_inventory._vial._sceneNumber != 5100) { + } else if (RING_INVENTORY._vial._sceneNumber != 5100) { _hotspot6.postInit(); _hotspot6.setVisage(5362); _hotspot6.setPosition(Common::Point(1152, 70)); - _hotspot6.setPriority2(170); + _hotspot6.fixPriority(170); _hotspot6.setStrip(6); _hotspot6.setFrame(1); _globals->_sceneItems.push_back(&_hotspot6); @@ -1275,9 +1282,9 @@ void Scene5100::postInit(SceneObjectList *OwnerList) { _hotspot15.setVisage(5140); _hotspot15.setStrip(3); _hotspot15.setPosition(Common::Point(977, 173)); - _hotspot15.setPriority2(1); + _hotspot15.fixPriority(1); - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position); loadScene(5100); _globals->_soundHandler.startSound(205); } @@ -1312,7 +1319,7 @@ void Scene5100::signal() { case 5108: if (!_globals->getFlag(60)) _globals->_player.enableControl(); - else if (_globals->_inventory._stasisBox._sceneNumber == 1) + else if (RING_INVENTORY._stasisBox._sceneNumber == 1) setAction(&_action2); else setAction(&_action5); @@ -1324,12 +1331,12 @@ void Scene5100::signal() { break; case 5111: _globals->_player.setObjectWrapper(new SceneObjectWrapper()); - _globals->_player.setVisage(6); + _globals->_player.setVisage(0); _globals->_player.setStrip(6); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.animate(ANIM_MODE_1, NULL); - if ((_globals->_inventory._vial._sceneNumber != 5100) && !_globals->getFlag(108)) { + if ((RING_INVENTORY._vial._sceneNumber != 5100) && !_globals->getFlag(108)) { _globals->setFlag(108); _sceneMode = 5130; _globals->_player.disableControl(); @@ -1344,14 +1351,14 @@ void Scene5100::signal() { break; case 5116: _globals->setFlag(105); - _globals->_inventory._bone._sceneNumber = 0; + RING_INVENTORY._bone._sceneNumber = 0; _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setVisage(0); _globals->_player.setStrip(6); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.animate(ANIM_MODE_1, NULL); - break; + // No break on purpose case 5117: _globals->_player.enableControl(); break; @@ -1370,6 +1377,7 @@ void Scene5100::signal() { } void Scene5100::dispatch() { + // Flesheater trap if (_hotspot15._bounds.contains(_globals->_player._position) && !_globals->_player._visage) { _globals->_player.disableControl(); _globals->_player.addMover(NULL); @@ -1388,7 +1396,7 @@ void Scene5100::dispatch() { _sceneMode = 5150; _soundHandler.startSound(208); - if (_globals->_inventory._vial._sceneNumber == 5100) { + if (RING_INVENTORY._vial._sceneNumber == 5100) { _globals->_player.addMover(NULL); _globals->_player.disableControl(); SceneItem::display2(5100, 39); @@ -1398,9 +1406,9 @@ void Scene5100::dispatch() { _hotspot3.setStrip2(2); ObjectMover3 *mover1 = new ObjectMover3(); - _hotspot2.addMover(mover1, 20, this); + _hotspot2.addMover(mover1, &_globals->_player, 20, this); ObjectMover3 *mover2 = new ObjectMover3(); - _hotspot3.addMover(mover2, 20, this); + _hotspot3.addMover(mover2, &_globals->_player, 20, this); } if (!_action) { @@ -1408,8 +1416,9 @@ void Scene5100::dispatch() { _globals->_player._canWalk = false; _globals->_player.addMover(NULL); + Common::Point pt(20, 25); PlayerMover2 *mover = new PlayerMover2(); - _hotspot3.addMover(mover, 20, 25, &_globals->_player); + _hotspot3.addMover(mover, &pt, &_globals->_player); setAction(&_action4); } @@ -1445,6 +1454,7 @@ void Scene5200::Action1::signal() { } void Scene5200::Action2::signal() { + // Quinn obtains the stasis box from the flesheater throne room Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene; switch (_actionIndex++) { @@ -1462,7 +1472,7 @@ void Scene5200::Action2::signal() { scene->_soundHandler.proc3(); scene->_hotspot14.remove(); - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox._sceneNumber = 1; _globals->_player.animate(ANIM_MODE_5, this); break; case 3: @@ -1489,6 +1499,7 @@ void Scene5200::Action2::signal() { void Scene5200::Action3::signal() { switch (_actionIndex++) { + case 0: _globals->_player.disableControl(); setDelay(5); break; @@ -1563,7 +1574,7 @@ void Scene5200::Hotspot10::doAction(int action) { } break; default: - SceneItem::doAction(action); + SceneObject::doAction(action); break; } } @@ -1578,9 +1589,6 @@ void Scene5200::Hotspot14::doAction(int action) { case CURSOR_USE: scene->setAction(&scene->_action2); break; - default: - SceneItem::doAction(action); - break; } } @@ -1611,7 +1619,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _speakerFLText._textPos.x = 160; _speakerQText._textPos.x = 20; - if (_globals->_inventory._stasisBox._sceneNumber == 5200) { + if (RING_INVENTORY._stasisBox._sceneNumber == 5200) { _soundHandler.startSound(216); _soundHandler.proc5(true); @@ -1619,17 +1627,20 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _hotspot14.setVisage(5202); _hotspot14._strip = 3; _hotspot14.setPosition(Common::Point(105, 52)); - _hotspot14.setPriority2(90); + _hotspot14.fixPriority(90); _hotspot8.postInit(); _hotspot8.setVisage(5202); _hotspot8._strip = 1; _hotspot8.setPosition(Common::Point(96, 53)); - _hotspot8.setPriority2(90); + _hotspot8.fixPriority(90); _globals->_sceneItems.push_back(&_hotspot14); } - if (_globals->_stripNum == 1111) { + if (_globals->_stripNum == 5111) { + // Happens when the player enters the throne room via the secret passage, + // after talking with the bat. No NPCs are around and the player can + // obtain the stasis box. _globals->_soundHandler.startSound(205); _globals->_player.disableControl(); @@ -1644,6 +1655,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { setAction(&_action3); } else { + // Happens when the player is captured by the flesh eaters the first time. _globals->_player.postInit(); _globals->_player.setVisage(2640); _globals->_player._strip = 1; @@ -1665,7 +1677,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _hotspot7.setVisage(5210); _hotspot7._frame = 1; _hotspot7._strip = 4; - _hotspot7.setPriority2(168); + _hotspot7.fixPriority(168); _hotspot7.setPosition(Common::Point(186, 106)); _hotspot1.postInit(); @@ -1677,20 +1689,20 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _hotspot2.setVisage(5212); _hotspot2._strip = 3; _hotspot2.setPosition(Common::Point(148, 141)); - _hotspot2.setPriority2(90); + _hotspot2.fixPriority(90); _hotspot3.postInit(); _hotspot3.setVisage(5212); _hotspot3._strip = 2; _hotspot3.setPosition(Common::Point(62, 109)); - _hotspot3.setPriority2(138); + _hotspot3.fixPriority(138); _hotspot3.setAction(&_action1); _hotspot4.postInit(); _hotspot4.setVisage(5212); _hotspot4._strip = 4; _hotspot4.setPosition(Common::Point(146, 110)); - _hotspot4.setPriority2(90); + _hotspot4.fixPriority(90); _globals->_player.disableControl(); _globals->setFlag(61); @@ -1701,9 +1713,11 @@ void Scene5200::postInit(SceneObjectList *OwnerList) { _hotspot11.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); _hotspot9._sceneRegionId = 11; _hotspot10._sceneRegionId = 9; + _hotspot12._sceneRegionId = 10; + _hotspot13._sceneRegionId = 8; _globals->_sceneItems.addItems(&_hotspot12, &_hotspot13, &_hotspot9, &_hotspot10, &_hotspot11, NULL); - _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position); + _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position); loadScene(5200); } @@ -1754,7 +1768,7 @@ void Scene5300::Action1::signal() { ADD_MOVER(_globals->_player, 85, 170); break; case 3: - scene->_hotspot2.setPriority2(-1); + scene->_hotspot2.fixPriority(-1); _globals->_player.checkAngle(&scene->_hotspot2); setAction(&scene->_sequenceManager, this, 5305, &scene->_hotspot2, NULL); break; @@ -1762,7 +1776,7 @@ void Scene5300::Action1::signal() { scene->_stripManager.start(5316, this); break; case 5: - if (!_globals->getFlag(106) || !_globals->getFlag(107) || (_globals->_inventory._stasisBox._sceneNumber != 1)) { + if (!_globals->getFlag(106) || !_globals->getFlag(107) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) { _globals->_player.enableControl(); remove(); } else { @@ -1793,7 +1807,7 @@ void Scene5300::Action2::signal() { scene->_stripManager.start(5328, this); break; case 2: - if (_globals->_inventory._stasisBox._sceneNumber == 1) { + if (RING_INVENTORY._stasisBox._sceneNumber == 1) { _globals->_stripNum = 5303; setDelay(5); } else { @@ -1871,7 +1885,7 @@ void Scene5300::Hotspot2::doAction(int action) { } else { _globals->_player.disableControl(); - if (_globals->_inventory._stasisBox._sceneNumber != 1) { + if (RING_INVENTORY._stasisBox._sceneNumber != 1) { scene->setAction(&scene->_sequenceManager, scene, 5316, NULL); } else { _globals->setFlag(60); @@ -1898,7 +1912,7 @@ void Scene5300::Hotspot2::doAction(int action) { if (_globals->getFlag(107)) { SceneItem::display2(5300, 8); } else { - _globals->_inventory._vial._sceneNumber = 5300; + RING_INVENTORY._vial._sceneNumber = 5300; _globals->setFlag(107); _globals->_player.disableControl(); scene->_sceneMode = 5304; @@ -1920,7 +1934,7 @@ void Scene5300::Hotspot5::doAction(int action) { SceneItem::display2(5300, 27); break; case CURSOR_USE: - _globals->_inventory._bone._sceneNumber = 1; + RING_INVENTORY._bone._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 5309; @@ -1933,24 +1947,25 @@ void Scene5300::Hotspot5::doAction(int action) { } void Scene5300::Hotspot6::doAction(int action) { + // Left Hole Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene; switch (action) { case CURSOR_LOOK: - if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber == 1)) + if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber == 1)) SceneItem::display2(5300, 4); else SceneItem::display2(5300, 26); break; case CURSOR_USE: - if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber != 5100)) { + if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber != 5100)) { _globals->_player.disableControl(); scene->_sceneMode = 5301; scene->setAction(&scene->_sequenceManager, scene, 5301, &_globals->_player, NULL); } else { _globals->_player.disableControl(); scene->_sceneMode = 5307; - _globals->_inventory._vial._sceneNumber = 1; + RING_INVENTORY._vial._sceneNumber = 1; scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &_globals->_player, &scene->_hotspot4, NULL); @@ -2033,7 +2048,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) { _hotspot2.setVisage(5310); _hotspot2.setPosition(Common::Point(63, 170)); _hotspot2.animate(ANIM_MODE_1, NULL); - _hotspot2.setPriority2(98); + _hotspot2.fixPriority(98); } _hotspot1.postInit(); @@ -2075,7 +2090,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) { _hotspot3.postInit(); _hotspot3.setVisage(5301); _hotspot3.setPosition(Common::Point(172, 32)); - _hotspot3.setPriority2(1); + _hotspot3.fixPriority(1); _hotspot3.animate(ANIM_MODE_NONE, NULL); _globals->_player.postInit(); @@ -2091,7 +2106,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) { } _field1B0A = 1; - if (_globals->_inventory._bone._sceneNumber == 5300) { + if (RING_INVENTORY._bone._sceneNumber == 5300) { _hotspot5.postInit(); _hotspot5.setVisage(5301); _hotspot5.setStrip(2); @@ -2113,6 +2128,9 @@ void Scene5300::signal() { _globals->_stripNum = 5300; _globals->_sceneManager.changeScene(5100); break; + case 5307: + _soundHandler.proc1(NULL); + // No break on purpose case 5302: case 5308: case 5316: @@ -2143,21 +2161,18 @@ void Scene5300::signal() { _globals->clearFlag(67); _globals->_player.setStrip2(-1); - if ((_globals->_inventory._vial._sceneNumber == 1) || (_globals->_inventory._vial._sceneNumber == 5300)) + if ((RING_INVENTORY._vial._sceneNumber == 1) || (RING_INVENTORY._vial._sceneNumber == 5300)) _stripManager.start(5303, this); else _stripManager.start(5302, this); _sceneMode = 5302; break; - case 5307: - _soundHandler.proc1(NULL); - break; case 5309: _hotspot5.remove(); _globals->_player.enableControl(); break; case 5310: - _hotspot2.setPriority2(41); + _hotspot2.fixPriority(41); _sceneMode = 5315; setAction(&_sequenceManager, this, 5315, &_hotspot2, NULL); diff --git a/engines/tsage/ringworld_scenes6.h b/engines/tsage/ringworld_scenes6.h index 272aea4fe9..0d81bb3b78 100644 --- a/engines/tsage/ringworld_scenes6.h +++ b/engines/tsage/ringworld_scenes6.h @@ -216,11 +216,11 @@ class Scene5200 : public Scene { }; /* Hotspots */ - class Hotspot9 : public SceneItemExt { + class Hotspot9 : public SceneObjectExt { public: virtual void doAction(int action); }; - class Hotspot10 : public SceneItemExt { + class Hotspot10 : public SceneObjectExt { public: virtual void doAction(int action); }; @@ -321,8 +321,8 @@ public: Scene5300(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); - virtual void synchronise(Serialiser &s) { - Scene::synchronise(s); + virtual void synchronize(Serializer &s) { + Scene::synchronize(s); s.syncAsSint16LE(_field1B0A); } }; diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp index 416b7fe0fd..43bff50b47 100644 --- a/engines/tsage/ringworld_scenes8.cpp +++ b/engines/tsage/ringworld_scenes8.cpp @@ -31,6 +31,12 @@ namespace tSage { +void NamedHotspotMult::synchronize(Serializer &s) { + SceneHotspot::synchronize(s); + s.syncAsSint16LE(_useLineNum); + s.syncAsSint16LE(_lookLineNum); +} + /*-------------------------------------------------------------------------- * Scene 7000 * @@ -48,22 +54,23 @@ void Scene7000::Action1::signal() { setAction(&scene->_action6, this); break; case 2: - scene->_soundHandler.startSound(252, 0, 127); + scene->_soundHandler.startSound(252); scene->_object8.remove(); scene->_object1.postInit(); scene->_object1.setVisage(7003); scene->_object1.animate(ANIM_MODE_5, this); - scene->_object1.setPosition(Common::Point(151, 182), 0); - scene->_object1.setPriority2(205); + scene->_object1.setPosition(Common::Point(151, 182)); + scene->_object1.fixPriority(205); _globals->_sceneItems.push_front(&scene->_object1); break; case 3: - scene->_object1.setStrip(4); - scene->_object1.animate(ANIM_MODE_8, 0, 0); + scene->_object1._numFrames = 4; + scene->_object1.setStrip(2); + scene->_object1.animate(ANIM_MODE_8, 0, NULL); scene->_stripManager.start(7005, this); break; case 4: - scene->_object1.animate(ANIM_MODE_2, 0); + scene->_object1.animate(ANIM_MODE_2, NULL); setDelay(3); break; case 5: @@ -84,7 +91,7 @@ void Scene7000::Action2::signal() { setDelay(3); break; case 1: - _globals->_player.addMover(0, 0); + _globals->_player.addMover(NULL); _globals->_player.setVisage(7006); _globals->_player.setStrip(1); _globals->_player.setFrame(1); @@ -107,7 +114,7 @@ void Scene7000::Action3::dispatch() { Action::dispatch(); if (_actionIndex == 4) - scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y)); + scene->_object4.setPosition(scene->_object3._position); } /*--------------------------------------------------------------------------*/ @@ -122,9 +129,9 @@ void Scene7000::Action3::signal() { scene->_object4.postInit(); scene->_object4.setVisage(5001); scene->_object4.setStrip2(2); - scene->_object4.animate(ANIM_MODE_8, 0, 0); - scene->_object4.setPosition(Common::Point(10, 18), 0); - scene->_object4.setPriority2(10); + scene->_object4.animate(ANIM_MODE_8, 0, NULL); + scene->_object4.setPosition(Common::Point(10, 18)); + scene->_object4.fixPriority(10); scene->_object4.changeZoom(100); scene->_object4.hide(); break; @@ -135,8 +142,9 @@ void Scene7000::Action3::signal() { break; } case 2: - scene->_object3.setPriority2(10); - scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y + 15), 0); + scene->_object3._moveDiff.y = 1; + scene->_object3.fixPriority(10); + scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y + 15)); scene->_object4.show(); setDelay(30); break; @@ -169,15 +177,15 @@ void Scene7000::Action4::signal() { setDelay(300); break; case 2: - _globals->_soundHandler.startSound(252, 0, 127); + _globals->_soundHandler.startSound(252); scene->_object1.show(); scene->_object1.setStrip(3); scene->_object1.setFrame(1); scene->_object1.animate(ANIM_MODE_5, this); break; case 3: - scene->_object1.setStrip(1); - scene->_object1.animate(ANIM_MODE_8, 0, 0); + scene->_object1.setStrip(4); + scene->_object1.animate(ANIM_MODE_8, 0, NULL); _globals->setFlag(81); _globals->_player.enableControl(); remove(); @@ -199,7 +207,7 @@ void Scene7000::Action5::signal() { } case 1: _globals->_player.checkAngle(&scene->_object1); - _globals->_soundHandler.startSound(252, 0, 127); + _globals->_soundHandler.startSound(252); scene->_object1.setStrip(2); scene->_stripManager.start(7015, this); break; @@ -222,7 +230,7 @@ void Scene7000::Action5::signal() { break; } case 5: { - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); NpcMover *mover = new NpcMover(); Common::Point pt(11, 89); _globals->_player.addMover(mover, &pt, this); @@ -268,7 +276,7 @@ void Scene7000::Action6::signal() { NpcMover *mover = new NpcMover(); Common::Point pt(31, 96); _globals->_player.addMover(mover, &pt, this); - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); break; } case 4: { @@ -315,7 +323,7 @@ void Scene7000::Action7::signal() { break; } case 4: { - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); NpcMover *mover = new NpcMover(); Common::Point pt(11, 89); _globals->_player.addMover(mover, &pt, this); @@ -338,11 +346,11 @@ void Scene7000::Action7::signal() { /*--------------------------------------------------------------------------*/ -void Scene7000::SceneItem1::doAction(int action) { +void Scene7000::Hotspot1::doAction(int action) { if (action == CURSOR_LOOK) - SceneItem::display(7000, 2, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - - SceneItem::doAction(action); + SceneItem::display2(7000, 2); + else + SceneHotspot::doAction(action); } /*--------------------------------------------------------------------------*/ @@ -353,86 +361,84 @@ void Scene7000::Object1::doAction(int action) { switch (action) { case OBJECT_TRANSLATOR: _globals->_player.disableControl(); - _globals->_inventory._translator._sceneNumber = 7000; - if (_globals->_inventory._waldos._sceneNumber == 7000) { - if (_globals->_inventory._jar._sceneNumber == 7000) { - scene->_sceneMode = 7012; - scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0); - } else { - scene->_sceneMode = 7015; - scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, 0, 0); - } + RING_INVENTORY._translator._sceneNumber = 7000; + + if ((RING_INVENTORY._waldos._sceneNumber != 7000) && (RING_INVENTORY._jar._sceneNumber != 7000)) { + scene->_sceneMode = 7004; + scene->setAction(&scene->_sequenceManager, scene, 7004, &_globals->_player, this, NULL); + } else if (RING_INVENTORY._waldos._sceneNumber != 7000) { + scene->_sceneMode = 7011; + scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL); + } else if (RING_INVENTORY._jar._sceneNumber != 7000) { + scene->_sceneMode = 7012; + scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL); } else { - if (_globals->_inventory._jar._sceneNumber == 7000) { - scene->_sceneMode = 7011; - scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0); - } else { - scene->_sceneMode = 7004; - scene->setAction(&scene->_sequenceManager, scene, 7004, &_globals->_player, this, 0, 0); - } + scene->_sceneMode = 7015; + scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, NULL); } break; case OBJECT_WALDOS: _globals->_player.disableControl(); - _globals->_inventory._waldos._sceneNumber = 7000; - if (_globals->_inventory._translator._sceneNumber == 7000) { - if (_globals->_inventory._jar._sceneNumber == 7000) { + RING_INVENTORY._waldos._sceneNumber = 7000; + if (RING_INVENTORY._translator._sceneNumber == 7000) { + if (RING_INVENTORY._jar._sceneNumber == 7000) { scene->_sceneMode = 7015; - scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, NULL); } else { scene->_sceneMode = 7006; - scene->setAction(&scene->_sequenceManager, scene, 7006, &_globals->_player, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7006, &_globals->_player, NULL); } } else { scene->_sceneMode = 7009; - scene->setAction(&scene->_sequenceManager, scene, 7009, &_globals->_player, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7009, &_globals->_player, NULL); } break; case OBJECT_JAR: _globals->_player.disableControl(); - _globals->_inventory._jar._sceneNumber = 7000; - if (_globals->_inventory._translator._sceneNumber == 7000) { - if (_globals->_inventory._waldos._sceneNumber == 7000) { + RING_INVENTORY._jar._sceneNumber = 7000; + + if (RING_INVENTORY._translator._sceneNumber == 7000) { + if (RING_INVENTORY._waldos._sceneNumber != 7000) { scene->_sceneMode = 7007; - scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, NULL); } else { scene->_sceneMode = 7015; - scene->setAction(&scene->_sequenceManager, scene, 7016, &_globals->_player, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7016, &_globals->_player, NULL); } } else { scene->_sceneMode = 7008; - scene->setAction(&scene->_sequenceManager, scene, 7008, &_globals->_player, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7008, &_globals->_player, NULL); } break; case CURSOR_LOOK: if (_globals->getFlag(81)) - SceneItem::display(7000, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7000, 1); else - SceneItem::display(7000, 0, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7000, 0); break; case CURSOR_USE: if (_globals->getFlag(81)) { - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox2._sceneNumber = 1; _globals->_player.disableControl(); scene->setAction(&scene->_action5); } else { - SceneItem::display(7000, 5, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7000, 5); } break; case CURSOR_TALK: if (_globals->getFlag(81)) { - _globals->_inventory._stasisBox._sceneNumber = 1; + RING_INVENTORY._stasisBox2._sceneNumber = 1; _globals->_player.disableControl(); scene->setAction(&scene->_action5); } else if (_globals->getFlag(52)) { scene->_sceneMode = 7005; - scene->setAction(&scene->_sequenceManager, scene, 7013, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7013, NULL); } else if (_globals->getFlag(13)) { _globals->_sceneManager._sceneNumber = 7002; - scene->setAction(&scene->_sequenceManager, scene, 7014, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7014, NULL); } else { _globals->_sceneManager._sceneNumber = 7002; - scene->setAction(&scene->_sequenceManager, scene, 7002, 0, 0); + scene->setAction(&scene->_sequenceManager, scene, 7002, NULL); } break; default: @@ -450,8 +456,8 @@ void Scene7000::dispatch() { if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 8) { if (!_globals->getFlag(13)) { _globals->_player.disableControl(); - _globals->_player.addMover(0); - SceneItem::display(7000, 3, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + _globals->_player.addMover(NULL); + SceneItem::display2(7000, 3); _sceneMode = 7001; setAction(&scene->_sequenceManager, this, 7001, &_globals->_player, NULL); } else if (!_globals->getFlag(52)) { @@ -459,7 +465,7 @@ void Scene7000::dispatch() { } else { _globals->_player.disableControl(); _sceneMode = 7003; - setAction(&scene->_sequenceManager, this, 7003, &_globals->_player, 0); + setAction(&scene->_sequenceManager, this, 7003, &_globals->_player, NULL); } } if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 9) @@ -486,39 +492,38 @@ void Scene7000::postInit(SceneObjectList *OwnerList) { _object5.postInit(); _object5.setVisage(7001); _object5.setStrip2(1); - _object5.animate(ANIM_MODE_2, 0); - _object5.setPosition(Common::Point(49, 147), 0); - _object5.setPriority2(1); + _object5.animate(ANIM_MODE_2, NULL); + _object5.setPosition(Common::Point(49, 147)); + _object5.fixPriority(1); _object6.postInit(); _object6.setVisage(7001); _object6.setStrip2(2); - _object6.animate(ANIM_MODE_2, 0); - _object6.setPosition(Common::Point(160, 139), 0); - _object6.setPriority2(1); + _object6.animate(ANIM_MODE_2, NULL); + _object6.setPosition(Common::Point(160, 139)); + _object6.fixPriority(1); _object7.postInit(); _object7.setVisage(7001); _object7.setStrip2(3); - _object7.animate(ANIM_MODE_2, 0); - _object7.setPosition(Common::Point(272, 129), 0); - _object7.setPriority2(1); + _object7.animate(ANIM_MODE_2, NULL); + _object7.setPosition(Common::Point(272, 129)); + _object7.fixPriority(1); _object8.postInit(); _object8.setVisage(7001); _object8.setStrip2(4); - _object8.animate(ANIM_MODE_2, 0); - _object8.setPosition(Common::Point(176, 175), 0); - _object8.setPriority2(1); + _object8.animate(ANIM_MODE_2, NULL); + _object8.setPosition(Common::Point(176, 175)); + _object8.fixPriority(1); if (_globals->getFlag(72)) { _object3.postInit(); _object3.setVisage(5001); _object3.setStrip2(1); - _object3.animate(ANIM_MODE_2, 0); - _object3.setPosition(Common::Point(107, 92), 0); + _object3.setPosition(Common::Point(107, 92)); _object3.changeZoom(100); - _object3.setPriority2(10); + _object3.fixPriority(10); _object1.postInit(); _object1.setVisage(7003); @@ -526,55 +531,55 @@ void Scene7000::postInit(SceneObjectList *OwnerList) { _object1.setStrip(4); else _object1.setStrip(2); - _object1.setPosition(Common::Point(87, 129), 0); + _object1.setPosition(Common::Point(87, 129)); _object1._numFrames = 4; _object1.changeZoom(45); - _object1.animate(ANIM_MODE_8, 0, 0); - _globals->_sceneItems.addItems(&_object1, 0); + _object1.animate(ANIM_MODE_8, 0, NULL); + _globals->_sceneItems.push_back(&_object1); } - _soundHandler.startSound(251, 0, 127); + _soundHandler.startSound(251); if (_globals->_sceneManager._previousScene == 2100) { if (_globals->getFlag(72)) { _globals->_player.postInit(); _globals->_player.setVisage(0); - _globals->_player.animate(ANIM_MODE_1, 0); + _globals->_player.animate(ANIM_MODE_1, NULL); SceneObjectWrapper *wrapper = new SceneObjectWrapper(); _globals->_player.setObjectWrapper(wrapper); - _globals->_player.setPosition(Common::Point(57, 94), 0); + _globals->_player.setPosition(Common::Point(57, 94)); _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); if (_globals->getFlag(81)) { setAction(&_action4); } else { - _object1.setPosition(Common::Point(151, 182), 0); + _object1.setPosition(Common::Point(151, 182)); + _object1.changeZoom(100); setAction(&_action1); } } else { - _globals->_soundHandler.startSound(250, 0, 127); + _globals->_soundHandler.startSound(250); _globals->setFlag(72); _object3.postInit(); _object3.setVisage(5001); _object3.setStrip2(1); - _object3.animate(ANIM_MODE_1, 0); - _object3.setPosition(Common::Point(307, 0), 0); + _object3.animate(ANIM_MODE_1, NULL); + _object3.setPosition(Common::Point(307, 0)); _object3.changeZoom(-1); setAction(&_action3); } } else if (_globals->_sceneManager._previousScene == 2280) { _globals->_player.postInit(); _globals->_player.setVisage(2170); - _globals->_player.animate(ANIM_MODE_1, 0); - SceneObjectWrapper *wrapper = new SceneObjectWrapper(); - _globals->_player.setObjectWrapper(wrapper); - _globals->_player.setPosition(Common::Point(57, 94), 0); + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.setObjectWrapper(new SceneObjectWrapper()); + _globals->_player.setPosition(Common::Point(57, 94)); _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); _globals->_player.disableControl(); _sceneMode = 7001; setAction(&_action6, this); if (!_globals->getFlag(81)) { - _object1.setPosition(Common::Point(151, 182), 0); + _object1.setPosition(Common::Point(151, 182)); _object1.changeZoom(100); } _object8.remove(); @@ -582,12 +587,12 @@ void Scene7000::postInit(SceneObjectList *OwnerList) { } else if (_globals->_sceneManager._previousScene == 2320) { _globals->_player.postInit(); _globals->_player.setVisage(0); - _globals->_player.animate(ANIM_MODE_1, 0); + _globals->_player.animate(ANIM_MODE_1, NULL); SceneObjectWrapper *wrapper = new SceneObjectWrapper(); _globals->_player.setObjectWrapper(wrapper); - _globals->_player.setPosition(Common::Point(57, 94), 0); + _globals->_player.setPosition(Common::Point(57, 94)); _globals->_player.changeZoom(-1); - _globals->_player.setPriority2(10); + _globals->_player.fixPriority(10); _sceneMode = 7001; setAction(&_action6, this); } else { @@ -596,12 +601,15 @@ void Scene7000::postInit(SceneObjectList *OwnerList) { _object3.postInit(); _object3.setVisage(5001); _object3.setStrip2(1); - _object3.setPosition(Common::Point(307, 0), 0); - _soundHandler.startSound(151, 0, 127); + _object3.setPosition(Common::Point(307, 0)); + _soundHandler.startSound(151); _soundHandler.proc5(1); - _globals->_soundHandler.startSound(250, 0, 127); + _globals->_soundHandler.startSound(250); setAction(&_action3); } + + _hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + _globals->_sceneItems.push_back(&_hotspot1); } /*--------------------------------------------------------------------------*/ @@ -612,6 +620,10 @@ void Scene7000::signal() { case 7001: case 7002: case 7004: + case 7005: + case 7006: + case 7007: + case 7008: case 7009: _globals->_player.enableControl(); break; @@ -709,7 +721,7 @@ void Scene7100::Action5::signal() { } case 3: { scene->_object9.setStrip2(2); - scene->_object9.setPriority2(180); + scene->_object9.fixPriority(180); Common::Point pt(8, 181); NpcMover *mover = new NpcMover(); scene->_object9.addMover(mover, &pt, this); @@ -728,14 +740,14 @@ void Scene7100::Action6::signal() { switch (_actionIndex++) { case 0: setDelay(1); - scene->_object10.setPriority2(8); - scene->_object10.setPosition(Common::Point(155, 187), 0); + scene->_object10.fixPriority(8); + scene->_object10.setPosition(Common::Point(155, 187)); - scene->_object11.setPriority2(8); - scene->_object11.setPosition(Common::Point(155, 190), 0); + scene->_object11.fixPriority(8); + scene->_object11.setPosition(Common::Point(155, 190)); - scene->_object12.setPriority2(8); - scene->_object12.setPosition(Common::Point(151, 193), 0); + scene->_object12.fixPriority(8); + scene->_object12.setPosition(Common::Point(151, 193)); break; case 1: { Common::Point pt1(167, 187); @@ -744,11 +756,11 @@ void Scene7100::Action6::signal() { Common::Point pt2(165, 185); NpcMover *mover2 = new NpcMover(); - scene->_object11.addMover(mover2, &pt2, 0); + scene->_object11.addMover(mover2, &pt2, NULL); Common::Point pt3(163, 183); NpcMover *mover3 = new NpcMover(); - scene->_object12.addMover(mover3, &pt3, 0); + scene->_object12.addMover(mover3, &pt3, NULL); break; } case 2: { @@ -758,16 +770,16 @@ void Scene7100::Action6::signal() { scene->_object10.addMover(mover1, &pt1, this); scene->_object11.setStrip2(6); - scene->_object11.setPriority2(50); + scene->_object11.fixPriority(50); Common::Point pt2(89, 185); NpcMover *mover2 = new NpcMover(); - scene->_object11.addMover(mover2, &pt2, 0); + scene->_object11.addMover(mover2, &pt2, NULL); scene->_object12.setStrip2(6); - scene->_object12.setPriority2(50); + scene->_object12.fixPriority(50); Common::Point pt3(87, 183); NpcMover *mover3 = new NpcMover(); - scene->_object12.addMover(mover3, &pt3, 0); + scene->_object12.addMover(mover3, &pt3, NULL); break; } case 3: @@ -795,7 +807,7 @@ void Scene7100::Action7::signal() { scene->_object13.setStrip2(2); Common::Point pt(524, 104); NpcMover *mover = new NpcMover(); - scene->_object13.addMover(mover, &pt, 0); + scene->_object13.addMover(mover, &pt, NULL); break; } case 3: @@ -823,11 +835,11 @@ void Scene7100::Action8::signal() { Common::Point pt2(480, 146); NpcMover *mover2 = new NpcMover(); - scene->_object18.addMover(mover2, &pt2, 0); + scene->_object18.addMover(mover2, &pt2, NULL); Common::Point pt3(470, 153); NpcMover *mover3 = new NpcMover(); - scene->_object19.addMover(mover3, &pt3, 0); + scene->_object19.addMover(mover3, &pt3, NULL); break; } case 2: { @@ -841,11 +853,11 @@ void Scene7100::Action8::signal() { Common::Point pt2(502, 179); NpcMover *mover2 = new NpcMover(); - scene->_object18.addMover(mover2, &pt2, 0); + scene->_object18.addMover(mover2, &pt2, NULL); Common::Point pt3(495, 184); NpcMover *mover3 = new NpcMover(); - scene->_object19.addMover(mover3, &pt3, 0); + scene->_object19.addMover(mover3, &pt3, NULL); break; } case 3: { @@ -859,11 +871,11 @@ void Scene7100::Action8::signal() { Common::Point pt2(379, 161); NpcMover *mover2 = new NpcMover(); - scene->_object18.addMover(mover2, &pt2, 0); + scene->_object18.addMover(mover2, &pt2, NULL); Common::Point pt3(373, 167); NpcMover *mover3 = new NpcMover(); - scene->_object19.addMover(mover3, &pt3, 0); + scene->_object19.addMover(mover3, &pt3, NULL); break; } case 4: { @@ -877,11 +889,11 @@ void Scene7100::Action8::signal() { Common::Point pt2(473, 187); NpcMover *mover2 = new NpcMover(); - scene->_object18.addMover(mover2, &pt2, 0); + scene->_object18.addMover(mover2, &pt2, NULL); Common::Point pt3(466, 192); NpcMover *mover3 = new NpcMover(); - scene->_object19.addMover(mover3, &pt3, 0); + scene->_object19.addMover(mover3, &pt3, NULL); break; } case 5: { @@ -891,11 +903,11 @@ void Scene7100::Action8::signal() { Common::Point pt2(552, 178); NpcMover *mover2 = new NpcMover(); - scene->_object18.addMover(mover2, &pt2, 0); + scene->_object18.addMover(mover2, &pt2, NULL); Common::Point pt3(541, 183); NpcMover *mover3 = new NpcMover(); - scene->_object19.addMover(mover3, &pt3, 0); + scene->_object19.addMover(mover3, &pt3, NULL); _actionIndex = 0; break; @@ -919,7 +931,7 @@ void Scene7100::Action9::signal() { } case 2: { scene->_object24.setStrip2(2); - scene->_object24.setPriority2(160); + scene->_object24.fixPriority(160); Common::Point pt(34, 159); NpcMover *mover = new NpcMover(); scene->_object24.addMover(mover, &pt, this); @@ -934,7 +946,7 @@ void Scene7100::Action9::signal() { } case 4: { scene->_object24.setStrip2(2); - scene->_object24.setPriority2(180); + scene->_object24.fixPriority(180); Common::Point pt(-12, 182); NpcMover *mover = new NpcMover(); scene->_object24.addMover(mover, &pt, this); @@ -1003,68 +1015,68 @@ void Scene7100::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _object2.setVisage(7161); - _object2.animate(ANIM_MODE_2, 0); - _object2.setPosition(Common::Point(10, 140), 0); + _object2.animate(ANIM_MODE_2, NULL); + _object2.setPosition(Common::Point(10, 140)); _object2._numFrames = 1; - _object2.setPriority2(180); - _object2.setAction(&_action1, 0); + _object2.fixPriority(180); + _object2.setAction(&_action1, NULL); _object3.postInit(); _object3.setVisage(7161); - _object3.animate(ANIM_MODE_2, 0); - _object3.setPosition(Common::Point(34, 115), 0); + _object3.animate(ANIM_MODE_2, NULL); + _object3.setPosition(Common::Point(34, 115)); _object3._numFrames = 1; - _object3.setPriority2(180); - _object3.setAction(&_action2, 0); + _object3.fixPriority(180); + _object3.setAction(&_action2, NULL); _object4.postInit(); _object4.setVisage(7164); - _object4.animate(ANIM_MODE_2, 0); - _object4.setPosition(Common::Point(-10, 159), 0); + _object4.animate(ANIM_MODE_2, NULL); + _object4.setPosition(Common::Point(-10, 159)); _object4._numFrames = 2; - _object4.setPriority2(250); - _object4.setAction(&_action3, 0); + _object4.fixPriority(250); + _object4.setAction(&_action3, NULL); _object5.postInit(); _object5.setVisage(7162); _object5.setStrip(3); - _object5.animate(ANIM_MODE_2, 0); - _object5.setPosition(Common::Point(20, 52), 0); - _object5.setAction(&_action4, 0); + _object5.animate(ANIM_MODE_2, NULL); + _object5.setPosition(Common::Point(20, 52)); + _object5.setAction(&_action4, NULL); _object9.postInit(); _object9.setVisage(7160); _object5.setStrip(2); - _object9.animate(ANIM_MODE_2, 0); - _object9.setPosition(Common::Point(110, 168), 0); + _object9.animate(ANIM_MODE_2, NULL); + _object9.setPosition(Common::Point(110, 168)); _object9._numFrames = 2; - _object9.setPriority2(16); - _object9.setAction(&_action5, 0); + _object9.fixPriority(16); + _object9.setAction(&_action5, NULL); _object13.postInit(); _object13.setVisage(7161); _object13.setStrip(8); - _object13.animate(ANIM_MODE_2, 0); - _object13.setPosition(Common::Point(524, 104), 0); + _object13.animate(ANIM_MODE_2, NULL); + _object13.setPosition(Common::Point(524, 104)); _object13._numFrames = 5; - _object13.setPriority2(250); - _object13.setAction(&_action7, 0); + _object13.fixPriority(250); + _object13.setAction(&_action7, NULL); _object17.postInit(); _object17.setVisage(7160); _object17.setStrip(3); - _object17.animate(ANIM_MODE_2, 0); - _object17.setPosition(Common::Point(552, 183), 0); + _object17.animate(ANIM_MODE_2, NULL); + _object17.setPosition(Common::Point(552, 183)); _object17._numFrames = 4; _object17._moveDiff.x = 12; _object17._moveDiff.y = 12; - _object17.setAction(&_action8, 0); + _object17.setAction(&_action8, NULL); _object18.postInit(); _object18.setVisage(7160); _object18.setStrip(3); - _object18.animate(ANIM_MODE_2, 0); - _object18.setPosition(Common::Point(552, 178), 0); + _object18.animate(ANIM_MODE_2, NULL); + _object18.setPosition(Common::Point(552, 178)); _object18._numFrames = 4; _object18._moveDiff.x = 12; _object18._moveDiff.y = 12; @@ -1072,8 +1084,8 @@ void Scene7100::postInit(SceneObjectList *OwnerList) { _object19.postInit(); _object19.setVisage(7160); _object19.setStrip(3); - _object19.animate(ANIM_MODE_2, 0); - _object19.setPosition(Common::Point(541, 183), 0); + _object19.animate(ANIM_MODE_2, NULL); + _object19.setPosition(Common::Point(541, 183)); _object19._numFrames = 4; _object19._moveDiff.x = 12; _object19._moveDiff.y = 12; @@ -1081,42 +1093,42 @@ void Scene7100::postInit(SceneObjectList *OwnerList) { _object24.postInit(); _object24.setVisage(7162); _object24.setStrip(1); - _object24.animate(ANIM_MODE_2, 0); - _object24.setPosition(Common::Point(-12, 182), 0); + _object24.animate(ANIM_MODE_2, NULL); + _object24.setPosition(Common::Point(-12, 182)); _object24._numFrames = 4; - _object24.setPriority2(180); - _object24.setAction(&_action9, 0); + _object24.fixPriority(180); + _object24.setAction(&_action9, NULL); _object25.postInit(); _object25.setVisage(7163); - _object25.animate(ANIM_MODE_2, 0); - _object25.setPosition(Common::Point(551, 145), 0); + _object25.animate(ANIM_MODE_2, NULL); + _object25.setPosition(Common::Point(551, 145)); _object25._numFrames = 5; - _object25.setPriority2(160); - _object25.setAction(&_action10, 0); + _object25.fixPriority(160); + _object25.setAction(&_action10, NULL); // Swimmer 1 _globals->_player.postInit(); _globals->_player.setVisage(7101); - _globals->_player.animate(ANIM_MODE_2, 0); + _globals->_player.animate(ANIM_MODE_2, NULL); _globals->_player._moveDiff.x = 4; _globals->_player._moveDiff.y = 2; - _globals->_player.setPosition(Common::Point(135, 135), 0); - _globals->_player.setPriority2(200); + _globals->_player.setPosition(Common::Point(135, 135)); + _globals->_player.fixPriority(200); _globals->_player.disableControl(); // Swimmer 2 _object1.postInit(); _object1.setVisage(7110); - _object1.animate(ANIM_MODE_1, 0); + _object1.animate(ANIM_MODE_1, NULL); _object1._moveDiff.x = 4; _object1._moveDiff.y = 2; - _object1.setPosition(Common::Point(100, 100), 0); + _object1.setPosition(Common::Point(100, 100)); setAction(&_action11); - _soundHandler1.startSound(270, 0, 127); - _soundHandler2.startSound(275, 0, 127); - _globals->_soundHandler.startSound(270, 0, 127); + _soundHandler1.startSound(270); + _soundHandler2.startSound(275); + _globals->_soundHandler.startSound(270); } /*-------------------------------------------------------------------------- * Scene 7200 @@ -1158,9 +1170,9 @@ void Scene7200::Action2::signal() { setDelay(3); break; case 1: { - scene->_object2.setPriority2(25); - scene->_object3.setPriority2(25); - scene->_object4.setPriority2(25); + scene->_object2.fixPriority(25); + scene->_object3.fixPriority(25); + scene->_object4.fixPriority(25); scene->_object2.setStrip(1); scene->_object3.setStrip(1); scene->_object4.setStrip(1); @@ -1169,16 +1181,16 @@ void Scene7200::Action2::signal() { scene->_object2.addMover(mover1, &pt1, this); NpcMover *mover2 = new NpcMover(); Common::Point pt2(56, 85); - scene->_object3.addMover(mover2, &pt2, 0); + scene->_object3.addMover(mover2, &pt2, NULL); NpcMover *mover3 = new NpcMover(); Common::Point pt3(54, 80); - scene->_object4.addMover(mover3, &pt3, 0); + scene->_object4.addMover(mover3, &pt3, NULL); break; } case 2: { - scene->_object2.setPriority2(160); - scene->_object3.setPriority2(160); - scene->_object4.setPriority2(160); + scene->_object2.fixPriority(160); + scene->_object3.fixPriority(160); + scene->_object4.fixPriority(160); scene->_object2.setStrip(2); scene->_object3.setStrip(2); scene->_object4.setStrip(2); @@ -1187,10 +1199,10 @@ void Scene7200::Action2::signal() { scene->_object2.addMover(mover1, &pt1, this); NpcMover *mover2 = new NpcMover(); Common::Point pt2(12, 84); - scene->_object3.addMover(mover2, &pt2, 0); + scene->_object3.addMover(mover2, &pt2, NULL); NpcMover *mover3 = new NpcMover(); Common::Point pt3(10, 79); - scene->_object4.addMover(mover3, &pt3, 0); + scene->_object4.addMover(mover3, &pt3, NULL); break; } case 3: @@ -1208,80 +1220,80 @@ void Scene7200::postInit(SceneObjectList *OwnerList) { Scene::postInit(); _object2.postInit(); _object2.setVisage(7160); - _object2.animate(ANIM_MODE_2, 0); + _object2.animate(ANIM_MODE_2, NULL); _object2.setZoom(10); - _object2.setPosition(Common::Point(53, 88), 0); + _object2.setPosition(Common::Point(53, 88)); _object2.setAction(&_action2); _object3.postInit(); _object3.setVisage(7160); - _object3.animate(ANIM_MODE_2, 0); + _object3.animate(ANIM_MODE_2, NULL); _object3.setZoom(10); - _object3.setPosition(Common::Point(55, 83), 0); + _object3.setPosition(Common::Point(55, 83)); _object4.postInit(); _object4.setVisage(7160); - _object4.animate(ANIM_MODE_2, 0); + _object4.animate(ANIM_MODE_2, NULL); _object4.setZoom(10); - _object4.setPosition(Common::Point(57, 78), 0); + _object4.setPosition(Common::Point(57, 78)); _object5.postInit(); _object5.setVisage(7201); - _object5.setPosition(Common::Point(300, 172), 0); + _object5.setPosition(Common::Point(300, 172)); _object5.setPriority(172); - _object5.animate(ANIM_MODE_2, 0); + _object5.animate(ANIM_MODE_2, NULL); _object5._numFrames = 3; _object6.postInit(); _object6.setVisage(7201); _object6.setStrip2(3); - _object6.setPosition(Common::Point(144, 97), 0); + _object6.setPosition(Common::Point(144, 97)); _object6.setPriority(199); - _object6.animate(ANIM_MODE_2, 0); + _object6.animate(ANIM_MODE_2, NULL); _object6._numFrames = 3; _object7.postInit(); _object7.setVisage(7201); _object7.setStrip2(4); - _object7.setPosition(Common::Point(115, 123), 0); + _object7.setPosition(Common::Point(115, 123)); _object7.setPriority(199); - _object7.animate(ANIM_MODE_2, 0); + _object7.animate(ANIM_MODE_2, NULL); _object7._numFrames = 3; _object8.postInit(); _object8.setVisage(7201); _object8.setStrip2(6); - _object8.setPosition(Common::Point(140, 173), 0); + _object8.setPosition(Common::Point(140, 173)); _object8.setPriority(199); - _object8.animate(ANIM_MODE_2, 0); + _object8.animate(ANIM_MODE_2, NULL); _object8._numFrames = 3; _object9.postInit(); _object9.setVisage(7201); _object9.setStrip2(7); - _object9.setPosition(Common::Point(215, 196), 0); + _object9.setPosition(Common::Point(215, 196)); _object9.setPriority(199); - _object9.animate(ANIM_MODE_2, 0); + _object9.animate(ANIM_MODE_2, NULL); _object9._numFrames = 3; // Orange swimmer _globals->_player.postInit(); _globals->_player.setVisage(7110); - _globals->_player.animate(ANIM_MODE_1, 0); + _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setZoom(50); - _globals->_player.setPosition(Common::Point(-18, 16), 0); + _globals->_player.setPosition(Common::Point(-18, 16)); _globals->_player.disableControl(); _swimmer.postInit(); _swimmer.setVisage(7101); - _swimmer.animate(ANIM_MODE_1, 0); + _swimmer.animate(ANIM_MODE_1, NULL); _swimmer.setObjectWrapper(new SceneObjectWrapper()); _swimmer.setZoom(50); - _swimmer.setPosition(Common::Point(-8, 16), 0); + _swimmer.setPosition(Common::Point(-8, 16)); setAction(&_action1); - _soundHandler.startSound(271, 0, 127); + _soundHandler.startSound(271); } /*-------------------------------------------------------------------------- @@ -1316,14 +1328,14 @@ void Scene7300::Action1::signal() { _globals->_player.setStrip(3); _globals->_player._numFrames = 5; _globals->_player.animate(ANIM_MODE_2, this); - if (_globals->_inventory._translator._sceneNumber == 1) + if (RING_INVENTORY._translator._sceneNumber == 1) scene->_stripManager.start(7310, this); else scene->_stripManager.start(7305, this); break; case 7: setDelay(3); - _globals->_soundHandler.proc1(0); + _globals->_soundHandler.proc1(NULL); break; case 8: _globals->_sceneManager.changeScene(2280); @@ -1342,7 +1354,7 @@ void Scene7300::Action2::signal() { break; case 1: NpcMover *mover1 = new NpcMover(); - Common::Point pt(_globals->_randomSource.getRandomNumber(203), _globals->_randomSource.getRandomNumber(96)); + Common::Point pt(_globals->_randomSource.getRandomNumber(3) + 203, _globals->_randomSource.getRandomNumber(3) + 96); scene->_object3.addMover(mover1, &pt, this); _actionIndex = 0; break; @@ -1360,7 +1372,7 @@ void Scene7300::Action3::signal() { break; case 1: NpcMover *mover1 = new NpcMover(); - Common::Point pt(_globals->_randomSource.getRandomNumber(76), _globals->_randomSource.getRandomNumber(78)); + Common::Point pt(_globals->_randomSource.getRandomNumber(5) + 76, _globals->_randomSource.getRandomNumber(5) + 78); scene->_object1.addMover(mover1, &pt, this); _actionIndex = 0; break; @@ -1414,69 +1426,69 @@ void Scene7300::postInit(SceneObjectList *OwnerList) { _object4.setVisage(7311); _object4.setStrip(1); _object4.setFrame(1); - _object4.setPosition(Common::Point(218, 157), 0); + _object4.setPosition(Common::Point(218, 157)); _object3.postInit(); _object3.setVisage(7311); _object3.setStrip(2); _object3.setFrame(1); - _object3.setPosition(Common::Point(203, 96), 0); + _object3.setPosition(Common::Point(203, 96)); _object3._numFrames = 2; _object3._moveDiff = Common::Point(1, 1); - _object3.animate(ANIM_MODE_8, 0, 0); - _object3._field7A = 2; + _object3.animate(ANIM_MODE_8, 0, NULL); + _object3._moveRate = 2; _object3.setAction(&_action2); _globals->_player.postInit(); _globals->_player.setVisage(7305); - _globals->_player.animate(ANIM_MODE_1, 0); - _globals->_player.setPosition(Common::Point(-100, 100), 0); + _globals->_player.animate(ANIM_MODE_1, NULL); + _globals->_player.setPosition(Common::Point(-100, 100)); _globals->_player.disableControl(); _object1.postInit(); _object1.setVisage(7312); - _object1.animate(ANIM_MODE_1, 0); + _object1.animate(ANIM_MODE_1, NULL); _object1._moveDiff = Common::Point(1, 1); - _object1.setPosition(Common::Point(76, 78), 0); - _object1._field7A = 1; + _object1.setPosition(Common::Point(76, 78)); + _object1._moveRate = 1; _object1.setAction(&_action3); _object2.postInit(); _object2.setVisage(7312); _object2.setStrip(2); - _object2.animate(ANIM_MODE_2, 0); - _object2.setPosition(Common::Point(77, 47), 0); - _object2.setPriority2(190); + _object2.animate(ANIM_MODE_2, NULL); + _object2.setPosition(Common::Point(77, 47)); + _object2.fixPriority(190); _object5.postInit(); _object5.setVisage(7300); - _object5.setPosition(Common::Point(106, 45), 0); - _object5.animate(ANIM_MODE_2, 0); + _object5.setPosition(Common::Point(106, 45)); + _object5.animate(ANIM_MODE_2, NULL); _object5._numFrames = 5; _object6.postInit(); _object6.setVisage(7300); _object6.setStrip2(2); - _object6.setPosition(Common::Point(283, 193), 0); - _object6.animate(ANIM_MODE_2, 0); + _object6.setPosition(Common::Point(283, 193)); + _object6.animate(ANIM_MODE_2, NULL); _object6._numFrames = 3; _object7.postInit(); _object7.setVisage(7300); _object7.setStrip(4); - _object7.setPosition(Common::Point(295, 77), 0); - _object7.animate(ANIM_MODE_2, 0); + _object7.setPosition(Common::Point(295, 77)); + _object7.animate(ANIM_MODE_2, NULL); _object7._numFrames = 3; _object8.postInit(); _object8.setVisage(7300); _object8.setStrip(5); - _object8.setPosition(Common::Point(1, 147), 0); - _object8.animate(ANIM_MODE_2, 0); + _object8.setPosition(Common::Point(1, 147)); + _object8.animate(ANIM_MODE_2, NULL); _object8._numFrames = 2; setAction(&_action1); - _globals->_soundHandler.startSound(272, 0, 127); + _globals->_soundHandler.startSound(272); } /*-------------------------------------------------------------------------- @@ -1530,41 +1542,41 @@ void Scene7600::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _object2.setVisage(7601); _object2.setStrip(1); - _object2.animate(ANIM_MODE_2, 0); + _object2.animate(ANIM_MODE_2, NULL); _object2.setPosition(Common::Point(48, 135)); - _object2.setPriority2(1); + _object2.fixPriority(1); _object3.postInit(); _object3.setVisage(7601); _object3.setStrip(2); - _object3.animate(ANIM_MODE_2, 0); + _object3.animate(ANIM_MODE_2, NULL); _object3.setPosition(Common::Point(158, 136)); - _object3.setPriority2(1); + _object3.fixPriority(1); _object4.postInit(); _object4.setVisage(7601); _object4.setStrip(3); - _object4.animate(ANIM_MODE_2, 0); + _object4.animate(ANIM_MODE_2, NULL); _object4.setPosition(Common::Point(293, 141)); - _object4.setPriority2(1); + _object4.fixPriority(1); _object5.postInit(); _object5.setVisage(7601); _object5.setStrip(4); - _object5.animate(ANIM_MODE_2, 0); + _object5.animate(ANIM_MODE_2, NULL); _object5.setPosition(Common::Point(405, 143)); - _object5.setPriority2(1); + _object5.fixPriority(1); _object6.postInit(); _object6.setVisage(7601); _object6.setStrip(5); - _object6.animate(ANIM_MODE_2, 0); + _object6.animate(ANIM_MODE_2, NULL); _object6.setPosition(Common::Point(379, 191)); - _object6.setPriority2(1); + _object6.fixPriority(1); _globals->_player.postInit(); _globals->_player.setVisage(2333); - _globals->_player.animate(ANIM_MODE_1, 0); + _globals->_player.animate(ANIM_MODE_1, NULL); _globals->_player.setObjectWrapper(new SceneObjectWrapper()); _globals->_player.setStrip(1); _globals->_player._moveDiff = Common::Point(16, 16); @@ -1578,7 +1590,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) { _globals->_player.setPosition(Common::Point(-50, 195)); setAction(&_action1); } - _sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y); + _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y); loadScene(7600); _soundHandler2.startSound(255); _soundHandler1.startSound(251); @@ -1590,7 +1602,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) { *--------------------------------------------------------------------------*/ void Scene7700::Action1::signal() { - SceneObject *fmtObj = (SceneObject *) _fmt; + SceneObjectExt *fmtObj = (SceneObjectExt *) _endHandler; switch (_actionIndex++) { case 0: { PlayerMover *mover1 = new PlayerMover(); @@ -1600,7 +1612,7 @@ void Scene7700::Action1::signal() { } case 1: _globals->_player.checkAngle(fmtObj); - if (_globals->_player._field8C == 0) + if (fmtObj->_state == 0) fmtObj->animate(ANIM_MODE_5, this); else fmtObj->animate(ANIM_MODE_6, this); @@ -1619,7 +1631,7 @@ void Scene7700::Action2::signal() { setDelay(_globals->_randomSource.getRandomNumber(60) + 60); break; case 1: - scene->_prof.animate(ANIM_MODE_7, 0, 0); + scene->_prof.animate(ANIM_MODE_7, 0, NULL); setDelay(20); break; case 3: @@ -1644,9 +1656,9 @@ void Scene7700::Action3::signal() { setDelay(60); // No break on purpose! case 2: - scene->_soundHandler.startSound(260, 0, 127); + scene->_soundHandler.startSound(260); scene->_object8.setVisage(7703); - scene->_object8.setPosition(Common::Point(177, 97), 0); + scene->_object8.setPosition(Common::Point(177, 97)); scene->_object8.setStrip2(3); scene->_object8.animate(ANIM_MODE_5, this); scene->_object8._numFrames = 3; @@ -1672,12 +1684,12 @@ void Scene7700::Action4::signal() { scene->_object13.postInit(); scene->_object13.setVisage(7700); scene->_object13.setStrip2(7); - scene->_object13.setPosition(Common::Point(151, 33), 0); + scene->_object13.setPosition(Common::Point(151, 33)); scene->_object13.animate(ANIM_MODE_5, this); break; case 3: CursorMan.showMouse(true); - SceneItem::display(7700, 11, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 11); _globals->_player.enableControl(); remove(); break; @@ -1692,7 +1704,7 @@ void Scene7700::Action5::signal() { break; case 1: { scene->_cloud.setFrame(_globals->_randomSource.getRandomNumber(1) + 1); - scene->_cloud.setPosition(Common::Point(133, 145 + _globals->_randomSource.getRandomNumber(54)), 0); + scene->_cloud.setPosition(Common::Point(133, 145 + _globals->_randomSource.getRandomNumber(54))); Common::Point pt(360, scene->_cloud._position.y); NpcMover *mover = new NpcMover(); @@ -1717,13 +1729,13 @@ void Scene7700::Action6::signal() { } case 2: scene->_easterEgg1.setStrip(2); - scene->_easterEgg1.setPosition(Common::Point(43, 65), 0); + scene->_easterEgg1.setPosition(Common::Point(43, 65)); scene->_easterEgg2.postInit(); scene->_easterEgg2.setVisage(7708); scene->_easterEgg2.setStrip(3); - scene->_easterEgg2.setPosition(Common::Point(116, 54), 0); - scene->_easterEgg2.animate(ANIM_MODE_2, 0); + scene->_easterEgg2.setPosition(Common::Point(116, 54)); + scene->_easterEgg2.animate(ANIM_MODE_2, NULL); setDelay(120); break; @@ -1737,14 +1749,14 @@ void Scene7700::Action6::signal() { void Scene7700::SceneHotspot1::doAction(int action) { if (action == CURSOR_LOOK) - SceneItem::display(7700, 4, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 4); else SceneHotspot::doAction(action); } void Scene7700::SceneHotspot2::doAction(int action) { if (action == CURSOR_LOOK) - SceneItem::display(7700, 6, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 6); else SceneHotspot::doAction(action); } @@ -1754,23 +1766,23 @@ void Scene7700::SceneHotspot3::doAction(int action) { switch (action) { case OBJECT_KEY: - SceneItem::display(7702, 3, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - _globals->_inventory._key._sceneNumber = 7700; + SceneItem::display2(7702, 3); + RING_INVENTORY._key._sceneNumber = 7700; break; case CURSOR_LOOK: - if (_globals->_inventory._key._sceneNumber == 7700) - scene->setAction(&scene->_action4, 0); + if (RING_INVENTORY._key._sceneNumber == 7700) + scene->setAction(&scene->_action4, NULL); else - SceneItem::display(7700, 53, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 53); break; case CURSOR_USE: if (!_globals->getFlag(78)) { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7715, 0); - } else if (_globals->_inventory._key._sceneNumber == 7700) { + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); + } else if (RING_INVENTORY._key._sceneNumber == 7700) { _globals->_player.disableControl(); scene->_sceneMode = 7705; - scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, 0); + scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, NULL); } break; default: @@ -1784,14 +1796,14 @@ void Scene7700::SceneHotspot4::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 12, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 12); break; case CURSOR_USE: if (!_globals->getFlag(78)) { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7715, 0); + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); } else { - SceneItem::display(7700, 12, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 12); } break; default: @@ -1805,18 +1817,18 @@ void Scene7700::SceneHotspot5::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 28, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 28); break; case CURSOR_USE: if (_globals->getFlag(78)) { - if (_globals->_inventory._paper._sceneNumber == 7700) { + if (RING_INVENTORY._paper._sceneNumber == 7700) { _globals->_player.disableControl(); scene->_sceneMode = 7708; - scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, 0); + scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, NULL); } } else { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7715, 0); + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); } break; default: @@ -1828,10 +1840,10 @@ void Scene7700::SceneHotspot5::doAction(int action) { void Scene7700::SceneHotspot6::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 43, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 43); break; case CURSOR_USE: - SceneItem::display(7700, 56, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 56); break; default: SceneHotspot::doAction(action); @@ -1841,7 +1853,7 @@ void Scene7700::SceneHotspot6::doAction(int action) { void Scene7700::SceneItem7::doAction(int action) { if (action == CURSOR_LOOK) - SceneItem::display(7700, 51, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 51); } void Scene7700::SceneHotspot8::doAction(int action) { @@ -1849,11 +1861,11 @@ void Scene7700::SceneHotspot8::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 48, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 48); break; case CURSOR_USE: scene->_sceneMode = 7709; - scene->_soundHandler.startSound(259, 0, 127); + scene->_soundHandler.startSound(259); scene->_object15.setFrame(scene->_object15.getFrameCount()); scene->_object15.animate(ANIM_MODE_6, scene); if ((scene->_field977 == 2) && (scene->_field97B == 0)) { @@ -1875,11 +1887,11 @@ void Scene7700::SceneHotspot9::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 48, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 48); break; case CURSOR_USE: scene->_sceneMode = 7709; - scene->_soundHandler.startSound(259, 0, 127); + scene->_soundHandler.startSound(259); scene->_object15.setFrame(1); scene->_object15.animate(ANIM_MODE_5, scene); if (scene->_field977 > 2) { @@ -1917,14 +1929,14 @@ void Scene7700::Object1::doAction(int action) { Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { - SceneItem::display(7700, _lookLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, _lookLineNum); } else if (action == CURSOR_USE) { if (_globals->getFlag(78)) { _globals->_player.disableControl(); scene->setAction(&scene->_action1, this); } else { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7715, 0); + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); } } else { SceneHotspot::doAction(action); @@ -1934,10 +1946,10 @@ void Scene7700::Object1::doAction(int action) { void Scene7700::SceneHotspot11::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, _lookLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, _lookLineNum); break; case CURSOR_USE: - SceneItem::display(7701, _useLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, _useLineNum); break; default: SceneHotspot::doAction(action); @@ -1948,7 +1960,7 @@ void Scene7700::SceneHotspot11::doAction(int action) { void Scene7700::Object1::signal() { if (_state == 0) { _state = 1; - SceneItem::display(7701, _defltLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, _defltLineNum); } else { _state = 0; } @@ -1959,19 +1971,19 @@ void Scene7700::Object3::doAction(int action) { Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { - SceneItem::display(7700, 34, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 34); } else if (action == CURSOR_USE) { if (_globals->getFlag(78)) { if (scene->_object3._frame == 1) { _globals->_player.disableControl(); scene->_sceneMode = 7707; - scene->setAction(&scene->_sequenceManager, scene, 7707, &_globals->_player, this, 0); + scene->setAction(&scene->_sequenceManager, scene, 7707, &_globals->_player, this, NULL); } else { - SceneItem::display(7700, 60, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 60); } } else { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7715, 0); + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); } } else { SceneHotspot::doAction(action); @@ -1984,30 +1996,30 @@ void Scene7700::Object7::doAction(int action) { switch (action) { case CURSOR_LOOK: if (_globals->getFlag(78)) - SceneItem::display(7700, 45, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 45); else - SceneItem::display(7700, 44, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 44); break; case CURSOR_USE: if (_globals->getFlag(78)) { - SceneItem::display(7701, 41, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, 41); } else { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7714, 0); + scene->setAction(&scene->_sequenceManager, scene, 7714, NULL); } break; case CURSOR_TALK: if (_globals->getFlag(78)) { - SceneItem::display(7702, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7702, 1); } else { _globals->_player.disableControl(); if (_state == 0) { _state = 1; scene->_sceneMode = 7703; - scene->setAction(&scene->_sequenceManager, scene, 7703, 0); + scene->setAction(&scene->_sequenceManager, scene, 7703, NULL); } else { scene->_sceneMode = 7712; - scene->setAction(&scene->_sequenceManager, scene, 7712, 0); + scene->setAction(&scene->_sequenceManager, scene, 7712, NULL); } } break; @@ -2015,10 +2027,10 @@ void Scene7700::Object7::doAction(int action) { if (!_globals->getFlag(78)) { _globals->_soundHandler.proc3(); _globals->setFlag(78); - setAction(0); + setAction(NULL); _globals->_player.disableControl(); scene->_sceneMode = 7704; - scene->setAction(&scene->_sequenceManager, scene, 7704, &_globals->_player, this, 0); + scene->setAction(&scene->_sequenceManager, scene, 7704, &_globals->_player, this, NULL); } break; default: @@ -2035,44 +2047,45 @@ void Scene7700::Object8::doAction(int action) { scene->_object9.postInit(); scene->_object9.setVisage(7701); scene->_object9.setStrip2(3); - scene->_object9.setPosition(Common::Point(91, 166), 0); - scene->_object9.setPriority2(200); + scene->_object9.setPosition(Common::Point(91, 166)); + scene->_object9.fixPriority(200); scene->_object14.postInit(); scene->_object14.setVisage(7701); scene->_object14.setStrip(2); - scene->_object14.setPriority2(250); - scene->_object14.setPosition(Common::Point(139, 151), 0); + scene->_object14.fixPriority(250); + scene->_object14.setPosition(Common::Point(139, 151)); scene->_gfxButton.setText(EXIT_MSG); - scene->_gfxButton._bounds.centre(140, 189); + scene->_gfxButton._bounds.center(140, 189); scene->_gfxButton.draw(); - scene->_gfxButton._bounds.expandPanes(); - _globals->_sceneItems.push_front(&scene->_object10); + _globals->_sceneItems.push_front(&scene->_sceneItem10); _globals->_sceneItems.push_front(&scene->_object9); _globals->_player._canWalk = false; - } else { + } else if (_globals->getFlag(78)) { scene->_object15.postInit(); scene->_object15.setVisage(7701); - scene->_object15.setPosition(Common::Point(140, 165), 0); - scene->_object15.setPriority2(200); + scene->_object15.setPosition(Common::Point(140, 165)); + scene->_object15.fixPriority(200); scene->_gfxButton.setText(EXIT_MSG); - scene->_gfxButton._bounds.centre(140, 186); + scene->_gfxButton._bounds.center(140, 186); scene->_gfxButton.draw(); scene->_gfxButton._bounds.expandPanes(); scene->_object19.postInit(); scene->_object19.setVisage(7700); scene->_object19.setStrip(6); - scene->_object19.setPosition(Common::Point(140, 192), 0); + scene->_object19.setPosition(Common::Point(140, 192)); - _globals->_sceneItems.push_front(&scene->_object10); - _globals->_sceneItems.push_front(&scene->_object8); - _globals->_sceneItems.push_front(&scene->_object9); + _globals->_sceneItems.push_front(&scene->_sceneItem10); + _globals->_sceneItems.push_front(&scene->_sceneHotspot8); + _globals->_sceneItems.push_front(&scene->_sceneHotspot9); _globals->_events.setCursor(CURSOR_WALK); _globals->_player._canWalk = false; + } else { + scene->setAction(&scene->_sequenceManager, scene, 7715, NULL); } } else { SceneHotspot::doAction(action); @@ -2084,13 +2097,13 @@ void Scene7700::Object9::doAction(int action) { switch (action) { case CURSOR_LOOK: - SceneItem::display(7700, 49, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 49); break; case CURSOR_USE: - SceneItem::display(7701, 42, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, 42); break; case CURSOR_TALK: - SceneItem::display(7702, 4, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7702, 4); break; case OBJECT_KEY: if (_frame == 1) { @@ -2100,10 +2113,10 @@ void Scene7700::Object9::doAction(int action) { scene->_object10.setStrip(4); scene->_object10.setPosition(Common::Point(159, 136)); _globals->_sceneItems.push_front(&scene->_object10); - scene->_object10.setPriority2(240); + scene->_object10.fixPriority(240); } - scene->_soundHandler.startSound(262, 0, 127); - scene->_object14.animate(ANIM_MODE_5, 0); + scene->_soundHandler.startSound(262); + scene->_object14.animate(ANIM_MODE_5, NULL); } _globals->_events.setCursor(CURSOR_WALK); break; @@ -2116,8 +2129,10 @@ void Scene7700::Object10::doAction(int action) { Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { - SceneItem::display(7700, 50, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 50); } else if (action == CURSOR_USE) { + _globals->_player._canWalk = true; + RING_INVENTORY._translator._sceneNumber = 1; _globals->setFlag(80); scene->_sceneItem10.remove(); scene->_gfxButton._bounds.expandPanes(); @@ -2135,19 +2150,19 @@ void Scene7700::Object11::doAction(int action) { switch (action) { case OBJECT_SCANNER: if (_frame != 1) - SceneItem::display(7701, 44, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, 44); else SceneItem::doAction(action); break; case CURSOR_LOOK: if (_frame != 1) - SceneItem::display(7700, 9, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 9); else - SceneItem::display(7700, 52, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 52); break; case CURSOR_USE: if (_frame != 1) { - SceneItem::display(7701, 8, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7701, 8); } else { _globals->setFlag(49); _globals->_player.disableControl(); @@ -2156,8 +2171,8 @@ void Scene7700::Object11::doAction(int action) { } break; case OBJECT_EMPTY_JAR: - _globals->_inventory._emptyJar._sceneNumber = 0; - _globals->_inventory._jar._sceneNumber = 1; + RING_INVENTORY._emptyJar._sceneNumber = 0; + RING_INVENTORY._jar._sceneNumber = 1; _globals->_player.disableControl(); scene->_sceneMode = 7710; scene->setAction(&scene->_sequenceManager, scene, 7710, &_globals->_player, NULL); @@ -2171,7 +2186,7 @@ void Scene7700::Object12::doAction(int action) { Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene; if (action == CURSOR_LOOK) { - SceneItem::display(7700, 15, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 15); } else if (action == CURSOR_USE) { if (_globals->getFlag(78)) { scene->_sceneMode = 7713; @@ -2188,13 +2203,13 @@ void Scene7700::Object12::doAction(int action) { void Scene7700::signal() { switch (_sceneMode) { case 7701: - _globals->_player.setPriority2(-1); + _globals->_player.fixPriority(-1); _globals->_player.setStrip2(-1); if (_globals->getFlag(78)) { _globals->_player.enableControl(); } else { _sceneMode = 7711; - setAction(&_sequenceManager, this, 7711, 0); + setAction(&_sequenceManager, this, 7711, NULL); } break; case 7702: @@ -2209,15 +2224,18 @@ void Scene7700::signal() { _globals->_player.enableControl(); break; case 7704: - _globals->_soundHandler.startSound(256, 0, 127); + _globals->_soundHandler.startSound(256); _prof.setStrip2(4); _prof.setFrame2(1); - _prof.setPosition(Common::Point(159, 87), 0); + _prof.setPosition(Common::Point(159, 87)); _globals->_player.enableControl(); break; case 7705: + RING_INVENTORY._key._sceneNumber = 1; + _globals->_player.enableControl(); + break; case 7708: - _globals->_inventory._key._sceneNumber = 1; + RING_INVENTORY._paper._sceneNumber = 1; _globals->_player.enableControl(); break; case 7709: @@ -2225,11 +2243,11 @@ void Scene7700::signal() { break; case 7710: _globals->_player.enableControl(); - SceneItem::display(7700, 62, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + SceneItem::display2(7700, 62); break; case 7713: _emptyJar.remove(); - _globals->_inventory._emptyJar._sceneNumber = 1; + RING_INVENTORY._emptyJar._sceneNumber = 1; break; default: break; @@ -2242,8 +2260,8 @@ void Scene7700::process(Event &event) { if (contains<SceneItem *>(_globals->_sceneItems, &_sceneItem10)) { if (_gfxButton.process(event)) { _sceneItem10.remove(); - _sceneHotspot15.remove(); - _sceneHotspot9.remove(); + _object15.remove(); + _object9.remove(); if (_globals->_sceneObjects->contains(&_object10)) _object10.remove(); if (_globals->_sceneObjects->contains(&_object14)) @@ -2258,9 +2276,9 @@ void Scene7700::process(Event &event) { if (!_globals->_sceneObjects->contains(&_easterEgg1)) { _easterEgg1.postInit(); _easterEgg1.setVisage(7708); - _easterEgg1.setPosition(Common::Point(163, 50), 0); - _easterEgg1.setPriority2(1); - _easterEgg1.animate(ANIM_MODE_2, 0); + _easterEgg1.setPosition(Common::Point(163, 50)); + _easterEgg1.fixPriority(1); + _easterEgg1.animate(ANIM_MODE_2, NULL); _easterEgg1.setAction(&_action6); } } @@ -2275,7 +2293,7 @@ void Scene7700::dispatch() { if ((_action == 0) && (_globals->_sceneRegions.indexOf(_globals->_player._position) == 30)) { _globals->_player.disableControl(); _sceneMode = 7702; - setAction(&_sequenceManager, this, 7702, &_globals->_player, 0); + setAction(&_sequenceManager, this, 7702, &_globals->_player, NULL); } Scene::dispatch(); } @@ -2296,12 +2314,12 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { _globals->_player.postInit(); _globals->_player.setVisage(4201); - _globals->_player.animate(ANIM_MODE_1, 0); + _globals->_player.animate(ANIM_MODE_1, NULL); SceneObjectWrapper *wrapper = new SceneObjectWrapper(); _globals->_player.setObjectWrapper(wrapper); - _globals->_player.setPosition(Common::Point(-19, 68), 0); + _globals->_player.setPosition(Common::Point(-19, 68)); _globals->_player.setStrip2(7); - _globals->_player.setPriority2(95); + _globals->_player.fixPriority(95); _globals->_player.changeZoom(80); _globals->_player._moveDiff.x = 6; _globals->_player._moveDiff.y = 3; @@ -2312,10 +2330,10 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { if (_globals->getFlag(78)) { _prof.setStrip2(4); - _prof.setPriority2(80); - _prof.setPosition(Common::Point(159, 87), 0); + _prof.fixPriority(80); + _prof.setPosition(Common::Point(159, 87)); } else { - _prof.setPosition(Common::Point(203, 87), 0); + _prof.setPosition(Common::Point(203, 87)); _prof.setStrip2(2); _prof._numFrames = 6; _prof.setAction(&_action2); @@ -2324,74 +2342,74 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { _cloud.postInit(); _cloud.setVisage(7700); _cloud.setStrip2(5); - _cloud.setPriority2(1); - _cloud.setPosition(Common::Point(133, 160), 0); + _cloud.fixPriority(1); + _cloud.setPosition(Common::Point(133, 160)); _cloud._moveDiff.x = 1; - _cloud._field7A = 7; + _cloud._moveRate = 7; _cloud.setAction(&_action5); _object1.postInit(); _object1.setVisage(7700); - _object1.setPosition(Common::Point(184, 61), 0); + _object1.setPosition(Common::Point(184, 61)); _object1._lookLineNum = 18; _object1._defltLineNum = 16; _object2.postInit(); _object2.setVisage(7700); - _object2.setPosition(Common::Point(184, 70), 0); - _object2.setPriority2(60); + _object2.setPosition(Common::Point(184, 70)); + _object2.fixPriority(60); _object2._lookLineNum = 19; _object2._defltLineNum = 17; _object3.postInit(); _object3.setVisage(7703); - _object3.setPosition(Common::Point(288, 36), 0); + _object3.setPosition(Common::Point(288, 36)); _object3.setStrip(2); _object4.postInit(); _object4.setVisage(7700); - _object4.setPosition(Common::Point(268, 59), 0); + _object4.setPosition(Common::Point(268, 59)); _object4.setStrip(2); _object4._lookLineNum = 37; _object4._defltLineNum = 35; _object5.postInit(); _object5.setVisage(7700); - _object5.setPosition(Common::Point(268, 67), 0); - _object5.setPriority2(58); + _object5.setPosition(Common::Point(268, 67)); + _object5.fixPriority(58); _object5.setStrip2(3); _object5._lookLineNum = 38; _object5._defltLineNum = 36; _object6.postInit(); _object6.setVisage(7700); - _object6.setPosition(Common::Point(268, 75), 0); - _object6.setPriority2(57); + _object6.setPosition(Common::Point(268, 75)); + _object6.fixPriority(57); _object6.setStrip2(4); _object6._lookLineNum = 40; _object6._defltLineNum = 43; _object8.postInit(); _object8.setVisage(7703); - _object8.setPosition(Common::Point(203, 91), 0); + _object8.setPosition(Common::Point(203, 91)); _object8.setStrip2(4); - _object8.setPriority2(86); + _object8.fixPriority(86); _sceneHotspot8.setBounds(82, 141, 161, 92); _sceneHotspot9.setBounds(82, 187, 161, 141); _cork.postInit(); _cork.setVisage(7703); - _cork.setPosition(Common::Point(32, 128), 0); + _cork.setPosition(Common::Point(32, 128)); if (_globals->getFlag(49)) _cork.setFrame(_cork.getFrameCount()); - if (_globals->_inventory._emptyJar._sceneNumber == 7700) { + if (RING_INVENTORY._emptyJar._sceneNumber == 7700) { _emptyJar.postInit(); _emptyJar.setVisage(7700); _emptyJar.setStrip(8); - _emptyJar.setPosition(Common::Point(189, 48), 0); + _emptyJar.setPosition(Common::Point(189, 48)); _globals->_sceneItems.addItems(&_emptyJar, NULL); } _sceneHotspot1._sceneRegionId = 28; @@ -2420,8 +2438,8 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { _sceneHotspot15._useLineNum = 6; _sceneHotspot15._lookLineNum = 7; _sceneHotspot16.setBounds(0, 130, 34, 103); - _sceneHotspot16._useLineNum = 8; - _sceneHotspot16._lookLineNum = 9; + _sceneHotspot16._useLineNum = 7; + _sceneHotspot16._lookLineNum = 8; _sceneHotspot17.setBounds(41, 180, 46, 170); _sceneHotspot17._useLineNum = 11; _sceneHotspot17._lookLineNum = 13; @@ -2492,8 +2510,8 @@ void Scene7700::postInit(SceneObjectList *OwnerList) { _globals->_sceneItems.addItems(&_object6, &_object5, &_object4, &_sceneHotspot6, &_sceneHotspot36, &_sceneItem7, NULL); _sceneMode = 7701; - setAction(&_sequenceManager, this, 7701, &_globals->_player, 0); - _soundHandler.startSound(256, 0, 127); + setAction(&_sequenceManager, this, 7701, &_globals->_player, NULL); + _soundHandler.startSound(256); } Scene7700::Scene7700() { diff --git a/engines/tsage/ringworld_scenes8.h b/engines/tsage/ringworld_scenes8.h index 0c39920614..713520c6a0 100644 --- a/engines/tsage/ringworld_scenes8.h +++ b/engines/tsage/ringworld_scenes8.h @@ -41,14 +41,15 @@ public: NamedHotspotMult() : SceneHotspot() {} virtual Common::String getClassName() { return "NamedHotspotMult"; } + virtual void synchronize(Serializer &s); }; class SceneObject7700 : public SceneObjectExt { public: int _lookLineNum, _defltLineNum; - virtual void synchronise(Serialiser &s) { - SceneObject::synchronise(s); + virtual void synchronize(Serializer &s) { + SceneObject::synchronize(s); s.syncAsSint16LE(_lookLineNum); s.syncAsSint16LE(_defltLineNum); } @@ -94,7 +95,7 @@ class Scene7000 : public Scene { }; /* Items */ - class SceneItem1 : public SceneItem { + class Hotspot1 : public SceneHotspot { public: virtual void doAction(int action); }; @@ -107,7 +108,7 @@ public: SpeakerQL _speakerQL; SpeakerQR _speakerQR; SpeakerQText _speakerQText; - SceneObject _object1; + Object1 _object1; SceneObject _object2; SceneObject _object3; SceneObject _object4; @@ -124,7 +125,7 @@ public: Action5 _action5; Action6 _action6; Action7 _action7; - SceneItem1 _sceneItem1; + Hotspot1 _hotspot1; virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index 7983e2a34c..a0091bfd6a 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -24,6 +24,7 @@ */ #include "common/savefile.h" +#include "graphics/palette.h" #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "tsage/globals.h" @@ -52,7 +53,7 @@ Saver::Saver() { Saver::~Saver() { // Internal validation that no saved object is still present int totalLost = 0; - for (SynchronisedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) { + for (SynchronizedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) { SavedObject *so = *i; if (so) ++totalLost; @@ -64,7 +65,7 @@ Saver::~Saver() { /*--------------------------------------------------------------------------*/ -void Serialiser::syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion, +void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion, Common::Serializer::Version maxVersion) { int idx; assert(ptr); @@ -88,7 +89,7 @@ void Serialiser::syncPointer(SavedObject **ptr, Common::Serializer::Version minV } } -void Serialiser::validate(const Common::String &s, Common::Serializer::Version minVersion, +void Serializer::validate(const Common::String &s, Common::Serializer::Version minVersion, Common::Serializer::Version maxVersion) { Common::String tempStr = s; syncString(tempStr, minVersion, maxVersion); @@ -97,7 +98,7 @@ void Serialiser::validate(const Common::String &s, Common::Serializer::Version m error("Savegame is corrupt"); } -void Serialiser::validate(int v, Common::Serializer::Version minVersion, +void Serializer::validate(int v, Common::Serializer::Version minVersion, Common::Serializer::Version maxVersion) { int tempVal = v; syncAsUint32LE(tempVal, minVersion, maxVersion); @@ -117,9 +118,10 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { _macroSaveFlag = true; _saveSlot = slot; - // Set up the serialiser + // Set up the serializer Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot)); - Serialiser serialiser(NULL, saveFile); + Serializer serializer(NULL, saveFile); + serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION); // Write out the savegame header tSageSavegameHeader header; @@ -128,14 +130,14 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { writeSavegameHeader(saveFile, header); // Save out objects that need to come at the start of the savegame - for (SynchronisedList<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { - (*i)->listenerSynchronise(serialiser); + for (SynchronizedList<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { + (*i)->listenerSynchronize(serializer); } // Save each registered SaveObject descendant object into the savegame file - for (SynchronisedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) { - serialiser.validate((*i)->getClassName()); - (*i)->synchronise(serialiser); + for (SynchronizedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) { + serializer.validate((*i)->getClassName()); + (*i)->synchronize(serializer); } // Save file complete @@ -151,34 +153,36 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { } Common::Error Saver::restore(int slot) { - assert(!getMacroSaveFlag()); + assert(!getMacroRestoreFlag()); // Signal any objects registered for notification _loadNotifiers.notify(false); // Set fields - _macroSaveFlag = true; + _macroRestoreFlag = true; _saveSlot = slot; _unresolvedPtrs.clear(); - // Set up the serialiser + // Set up the serializer Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_vm->generateSaveName(slot)); - Serialiser serialiser(saveFile, NULL); + Serializer serializer(saveFile, NULL); // Read in the savegame header tSageSavegameHeader header; readSavegameHeader(saveFile, header); delete header.thumbnail; + serializer.setSaveVersion(header.version); + // Load in data for objects that need to come at the start of the savegame for (Common::List<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) { - (*i)->listenerSynchronise(serialiser); + (*i)->listenerSynchronize(serializer); } // Loop through each registered object to load in the data - for (SynchronisedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) { - serialiser.validate((*i)->getClassName()); - (*i)->synchronise(serialiser); + for (SynchronizedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) { + serializer.validate((*i)->getClassName()); + (*i)->synchronize(serializer); } // Loop through the remaining data of the file, instantiating new objects. @@ -186,17 +190,17 @@ Common::Error Saver::restore(int slot) { // of instantiating a saved object registers it with the saver, and will then be resolved to whatever // object originally had a pointer to it as part of the post-processing step Common::String className; - serialiser.syncString(className); + serializer.syncString(className); while (className != "END") { SavedObject *savedObject; if (!_factoryPtr || ((savedObject = _factoryPtr(className)) == NULL)) error("Unknown class name '%s' encountered trying to restore savegame", className.c_str()); // Populate the contents of the object - savedObject->synchronise(serialiser); + savedObject->synchronize(serializer); // Move to next object - serialiser.syncString(className); + serializer.syncString(className); } // Post-process any unresolved pointers to get the correct pointer @@ -224,7 +228,7 @@ bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &head return false; header.version = in->readByte(); - if (header.version != TSAGE_SAVEGAME_VERSION) + if (header.version > TSAGE_SAVEGAME_VERSION) return false; // Read in the string @@ -261,16 +265,8 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h out->write(header.saveName.c_str(), header.saveName.size() + 1); // Get the active palette - uint32 workPal[256]; uint8 thumbPalette[256 * 3]; - const byte *srcP = (const byte *)&workPal[0]; - byte *destP = &thumbPalette[0]; - g_system->getPaletteManager()->grabPalette((byte *)workPal, 0, 256); - for (int idx = 0; idx < 256; ++idx, ++srcP) { - *destP++ = *srcP++; - *destP++ = *srcP++; - *destP++ = *srcP++; - } + g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256); // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); @@ -343,7 +339,7 @@ bool Saver::savegamesExist() const { */ int Saver::blockIndexOf(SavedObject *p) { int objIndex = 1; - SynchronisedList<SavedObject *>::iterator iObj; + Common::List<SavedObject *>::iterator iObj; for (iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) { SavedObject *iObjP = *iObj; @@ -355,6 +351,25 @@ int Saver::blockIndexOf(SavedObject *p) { } /** + * Returns the number of objects in the object list registry + */ +int Saver::getObjectCount() const { + return _objList.size(); +} + +/** + * List any currently active objects + */ +void Saver::listObjects() { + Common::List<SavedObject *>::iterator i; + int count = 1; + + for (i = _objList.begin(); i != _objList.end(); ++i, ++count) + debug("%d - %s", count, (*i)->getClassName().c_str()); + debugN("\n"); +} + +/** * Returns the pointer associated with the specified object index */ void Saver::resolveLoadPointers() { @@ -364,14 +379,16 @@ void Saver::resolveLoadPointers() { // Outer loop through the main object list int objIndex = 1; - for (SynchronisedList<SavedObject *>::iterator iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) { + for (SynchronizedList<SavedObject *>::iterator iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) { Common::List<SavedObjectRef>::iterator iPtr; + SavedObject *pObj = *iObj; for (iPtr = _unresolvedPtrs.begin(); iPtr != _unresolvedPtrs.end(); ) { SavedObjectRef &r = *iPtr; if (r._objIndex == objIndex) { // Found an unresolved pointer to this object - *r._savedObject = *iObj; + SavedObject **objPP = r._savedObject; + *objPP = pObj; iPtr = _unresolvedPtrs.erase(iPtr); } else { ++iPtr; diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index 83661b8f15..cf7d087e6e 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -36,7 +36,7 @@ namespace tSage { typedef void (*SaveNotifierFn)(bool postFlag); -#define TSAGE_SAVEGAME_VERSION 1 +#define TSAGE_SAVEGAME_VERSION 2 class SavedObject; @@ -51,16 +51,28 @@ struct tSageSavegameHeader { /*--------------------------------------------------------------------------*/ -#define SYNC_POINTER(x) s.syncPointer((SavedObject **)&x) +// FIXME: workaround to supress spurious strict-alias warnings on older GCC +// versions. this should be resolved with the savegame rewrite +#define SYNC_POINTER(x) do { \ + SavedObject **y = (SavedObject **)((void *)&x); \ + s.syncPointer(y); \ +} while (false) + #define SYNC_ENUM(FIELD, TYPE) int v_##FIELD = (int)FIELD; s.syncAsUint16LE(v_##FIELD); \ if (s.isLoading()) FIELD = (TYPE)v_##FIELD; /** - * Derived serialiser class with extra synchronisation types + * Derived serializer class with extra synchronisation types */ -class Serialiser : public Common::Serializer { +class Serializer : public Common::Serializer { public: - Serialiser(Common::SeekableReadStream *in, Common::WriteStream *out) : Common::Serializer(in, out) {} + Serializer(Common::SeekableReadStream *in, Common::WriteStream *out) : Common::Serializer(in, out) {} + + // HACK: TSAGE saved games contain a single byte for the savegame version, + // thus the normal syncVersion() Serializer member won't work here. In order + // to maintain compatibility with older game saves, this method is provided + // in order to set the savegame version from a byte + void setSaveVersion(byte version) { _version = version; } void syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion = 0, Common::Serializer::Version maxVersion = kLastVersion); @@ -75,13 +87,13 @@ public: class Serialisable { public: virtual ~Serialisable() {} - virtual void synchronise(Serialiser &s) = 0; + virtual void synchronize(Serializer &s) = 0; }; class SaveListener { public: virtual ~SaveListener() {} - virtual void listenerSynchronise(Serialiser &s) = 0; + virtual void listenerSynchronize(Serializer &s) = 0; }; /*--------------------------------------------------------------------------*/ @@ -92,7 +104,7 @@ public: virtual ~SavedObject(); virtual Common::String getClassName() { return "SavedObject"; } - virtual void synchronise(Serialiser &s) {} + virtual void synchronize(Serializer &s) {} static SavedObject *createInstance(const Common::String &className); }; @@ -103,9 +115,9 @@ public: * Derived list class with extra functionality */ template<typename T> -class SynchronisedList : public Common::List<T> { +class SynchronizedList : public Common::List<T> { public: - void synchronise(Serialiser &s) { + void synchronize(Serializer &s) { int entryCount; if (s.isLoading()) { @@ -170,7 +182,7 @@ typedef SavedObject *(*SavedObjectFactory)(const Common::String &className); class Saver { private: - SynchronisedList<SavedObject *> _objList; + Common::List<SavedObject *> _objList; FunctionList<bool> _saveNotifiers; FunctionList<bool> _loadNotifiers; Common::List<SaveListener *> _listeners; @@ -206,6 +218,8 @@ public: bool getMacroSaveFlag() const { return _macroSaveFlag; } bool getMacroRestoreFlag() const { return _macroRestoreFlag; } int blockIndexOf(SavedObject *p); + int getObjectCount() const; + void listObjects(); }; extern Saver *_saver; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 68320066d7..f554d546f6 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -27,6 +27,7 @@ #include "tsage/globals.h" #include "tsage/ringworld_logic.h" #include "tsage/tsage.h" +#include "tsage/saveload.h" namespace tSage { @@ -39,6 +40,7 @@ SceneManager::SceneManager() { _fadeMode = FADEMODE_GRADUAL; _scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); _saver->addListener(this); + _objectCount = 0; } SceneManager::~SceneManager() { @@ -46,6 +48,7 @@ SceneManager::~SceneManager() { } void SceneManager::setNewScene(int sceneNumber) { + warning("SetNewScene(%d)", sceneNumber); _nextSceneNumber = sceneNumber; } @@ -59,12 +62,16 @@ void SceneManager::checkScene() { } void SceneManager::sceneChange() { + int activeScreenNumber = 0; + // Handle removing the scene - if (_scene) + if (_scene) { + activeScreenNumber = _scene->_activeScreenNumber; _scene->remove(); + } // Clear the scene objects - SynchronisedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin(); + SynchronizedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin(); while (io != _globals->_sceneObjects->end()) { SceneObject *sceneObj = *io; ++io; @@ -80,7 +87,7 @@ void SceneManager::sceneChange() { } // Clear the hotspot list - SynchronisedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin(); + SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin(); while (ii != _globals->_sceneItems.end()) { SceneItem *sceneItem = *ii; ++ii; @@ -106,9 +113,20 @@ void SceneManager::sceneChange() { // Free any regions disposeRegions(); + // Ensure that the same number of objects are registered now as when the scene started + if (_objectCount > 0) { + assert(_objectCount == _saver->getObjectCount()); + } + _objectCount = _saver->getObjectCount(); + _globals->_sceneHandler._delayTicks = 2; + // Instantiate and set the new scene _scene = getNewScene(); - _scene->postInit(); + + if (!_saver->getMacroRestoreFlag()) + _scene->postInit(); + else + _scene->loadScene(activeScreenNumber); } Scene *SceneManager::getNewScene() { @@ -133,6 +151,7 @@ void SceneManager::fadeInIfNecessary() { } void SceneManager::changeScene(int newSceneNumber) { + warning("changeScene(%d)", newSceneNumber); // Fade out the scene ScenePalette scenePalette; uint32 adjustData = 0; @@ -145,7 +164,7 @@ void SceneManager::changeScene(int newSceneNumber) { } // Stop any objects that were animating - SynchronisedList<SceneObject *>::iterator i; + SynchronizedList<SceneObject *>::iterator i; for (i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) { SceneObject *sceneObj = *i; Common::Point pt(0, 0); @@ -208,18 +227,19 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) { _sceneLoadCount = loadCount; } -void SceneManager::listenerSynchronise(Serialiser &s) { +void SceneManager::listenerSynchronize(Serializer &s) { s.validate("SceneManager"); - _altSceneObjects.synchronise(s); + _altSceneObjects.synchronize(s); s.syncAsSint32LE(_sceneNumber); + s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber); + if (s.isLoading()) { changeScene(_sceneNumber); checkScene(); } - s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber); - _globals->_sceneManager._scrollerRect.synchronise(s); + _globals->_sceneManager._scrollerRect.synchronize(s); SYNC_POINTER(_globals->_scrollFollower); s.syncAsSint16LE(_loadMode); } @@ -230,19 +250,23 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), _backgroundBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) { _sceneMode = 0; _oldSceneBounds = Rect(4000, 4000, 4100, 4100); + Common::set_to(&_zoomPercents[0], &_zoomPercents[256], 0); } Scene::~Scene() { } -void Scene::synchronise(Serialiser &s) { +void Scene::synchronize(Serializer &s) { + if (s.getVersion() >= 2) + StripCallback::synchronize(s); + s.syncAsSint32LE(_field12); - s.syncAsSint32LE(_sceneNumber); + s.syncAsSint32LE(_screenNumber); s.syncAsSint32LE(_activeScreenNumber); s.syncAsSint32LE(_sceneMode); - _backgroundBounds.synchronise(s); - _sceneBounds.synchronise(s); - _oldSceneBounds.synchronise(s); + _backgroundBounds.synchronize(s); + _sceneBounds.synchronize(s); + _oldSceneBounds.synchronize(s); s.syncAsSint16LE(_fieldA); s.syncAsSint16LE(_fieldE); @@ -269,7 +293,8 @@ void Scene::dispatch() { } void Scene::loadScene(int sceneNum) { - _sceneNumber = sceneNum; + warning("loadScene(%d)", sceneNum); + _screenNumber = sceneNum; if (_globals->_scenePalette.loadPalette(sceneNum)) _globals->_sceneManager._hasPalette = true; @@ -277,10 +302,10 @@ void Scene::loadScene(int sceneNum) { } void Scene::loadSceneData(int sceneNum) { - _globals->_sceneManager._scene->_activeScreenNumber = sceneNum; + _activeScreenNumber = sceneNum; // Get the basic scene size - byte *data = _vm->_dataManager->getResource(RES_BITMAP, sceneNum, 9999); + byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999); _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2)); _globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds); DEALLOCATE(data); @@ -411,7 +436,7 @@ void Scene::drawAltObjects() { Common::Array<SceneObject *> objList; // Initial loop to set the priority for entries in the list - for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin(); + for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin(); i != _globals->_sceneManager._altSceneObjects.end(); ++i) { SceneObject *obj = *i; objList.push_back(obj); diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 1a6f92745d..11637de1a7 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -39,7 +39,7 @@ private: void drawAltObjects(); public: int _field12; - int _sceneNumber; + int _screenNumber; int _activeScreenNumber; int _sceneMode; StripManager _stripManager; @@ -59,7 +59,7 @@ public: virtual ~Scene(); virtual Common::String getClassName() { return "Scene"; } - virtual void synchronise(Serialiser &s); + virtual void synchronize(Serializer &s); virtual void stripCallback(int v) {} virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); @@ -88,11 +88,12 @@ public: int _sceneLoadCount; Rect _scrollerRect; SceneObjectList _altSceneObjects; + int _objectCount; public: SceneManager(); virtual ~SceneManager(); - virtual void listenerSynchronise(Serialiser &s); + virtual void listenerSynchronize(Serializer &s); void setNewScene(int sceneNumber); void checkScene(); void sceneChange(); diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 7c8325d53e..9d50316baf 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -23,8 +23,6 @@ * */ -#include "common/config-manager.h" -#include "common/endian.h" #include "tsage/core.h" #include "tsage/globals.h" #include "tsage/debugger.h" @@ -54,9 +52,9 @@ void SoundManager::loadNotifierProc(bool postFlag) { warning("TODO: SoundManager::loadNotifierProc"); } -void SoundManager::listenerSynchronise(Serialiser &s) { +void SoundManager::listenerSynchronize(Serializer &s) { s.validate("SoundManager"); - warning("TODO: SoundManager listenerSynchronise"); + warning("TODO: SoundManager listenerSynchronize"); } } // End of namespace tSage diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index a495344038..45815de69f 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -34,7 +34,7 @@ namespace tSage { class SoundManager : public SaveListener { public: void dispatch() {} - virtual void listenerSynchronise(Serialiser &s); + virtual void listenerSynchronize(Serializer &s); virtual void postInit(); void proc2() {} diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 46b75e30ea..bc85718035 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -114,4 +114,7 @@ const char *SCENE6100_SWEAT = "Humans sweat, Kzin twitch their tail. What's the const char *SCENE6100_VERY_WELL = "Very well. I will retrieve the stasis box and return the probe. \ Wait for it's return in the lander bay."; +const char *DEMO_HELP_MSG = " Help...\rF2 - Sound Options\rF3 - Exit demo\r\rPress ENTER\rto continue"; +const char *DEMO_PAUSED_MSG = " demo is paused"; + } // End of namespace tSage diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index cb62272735..0db349f8a7 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -79,6 +79,10 @@ extern const char *SCENE6100_SURPRISE; extern const char *SCENE6100_SWEAT; extern const char *SCENE6100_VERY_WELL; +// Demo messages +extern const char *DEMO_HELP_MSG; +extern const char *DEMO_PAUSED_MSG; + } // End of namespace tSage #endif diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 1f6442f2ff..8813fc7e45 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -23,11 +23,7 @@ * */ -#include "common/config-manager.h" -#include "common/debug.h" #include "common/debug-channels.h" -#include "common/system.h" -#include "common/savefile.h" #include "engines/util.h" #include "tsage/tsage.h" @@ -46,7 +42,6 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) _vm = this; DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging"); _debugger = new Debugger(); - _dataManager = NULL; } Common::Error TSageEngine::init() { @@ -69,29 +64,34 @@ bool TSageEngine::hasFeature(EngineFeature f) const { } void TSageEngine::initialise() { - _tSageManager = new RlbManager(_memoryManager, "tsage.rlb"); - _dataManager = new RlbManager(_memoryManager, "ring.rlb"); - _saver = new Saver(); + + // Set up the resource manager + _resourceManager = new ResourceManager(); + if (_vm->getFeatures() & GF_DEMO) { + // Add the single library file associated with the demo + _resourceManager->addLib(getPrimaryFilename()); + } else { + _resourceManager->addLib("RING.RLB"); + _resourceManager->addLib("TSAGE.RLB"); + } + _globals = new Globals(); _globals->gfxManager().setDefaults(); } void TSageEngine::deinitialise() { delete _globals; + delete _resourceManager; delete _saver; - delete _tSageManager; - delete _dataManager; } Common::Error TSageEngine::run() { // Basic initialisation initialise(); - _globals->_events.showCursor(); - _globals->_sceneHandler.registerHandler(); - _globals->_game.execute(); + _globals->_game->execute(); deinitialise(); return Common::kNoError; @@ -101,14 +101,14 @@ Common::Error TSageEngine::run() { * Returns true if it is currently okay to restore a game */ bool TSageEngine::canLoadGameStateCurrently() { - return _globals->getFlag(50) == 0; + return (_globals->getFlag(50) == 0); } /** * Returns true if it is currently okay to save the game */ bool TSageEngine::canSaveGameStateCurrently() { - return _globals->getFlag(50) == 0; + return (_globals->getFlag(50) == 0); } /** diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 2a627d80bc..06c66d8f42 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -50,7 +50,8 @@ enum { enum { GF_DEMO = 1 << 0, GF_CD = 1 << 1, - GF_FLOPPY = 1 << 2 + GF_FLOPPY = 1 << 2, + GF_ALT_REGIONS = 1 << 3 }; enum { @@ -61,8 +62,8 @@ struct tSageGameDescription; #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 200 -#define SCREEN_CENTRE_X 160 -#define SCREEN_CENTRE_Y 100 +#define SCREEN_CENTER_X 160 +#define SCREEN_CENTER_Y 100 class TSageEngine : public Engine { private: @@ -74,12 +75,11 @@ public: MemoryManager _memoryManager; Debugger *_debugger; - RlbManager *_tSageManager; - RlbManager *_dataManager; const char *getGameId() const; uint32 getGameID() const; uint32 getFeatures() const; + Common::String getPrimaryFilename() const; virtual Common::Error init(); virtual Common::Error run(); |