diff options
author | whiterandrek | 2018-05-22 08:03:37 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 82974a9ce37aba6240f7c3543947631170f012c2 (patch) | |
tree | 6aeed5f5edfb1c758b2c18b8ac224bde40eaff8c /engines/pink/objects/actors | |
parent | 931d6adbcbbe063857814dc76886e9a967b2a4f3 (diff) | |
download | scummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.tar.gz scummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.tar.bz2 scummvm-rg350-82974a9ce37aba6240f7c3543947631170f012c2.zip |
PINK: fix indentation
Diffstat (limited to 'engines/pink/objects/actors')
-rw-r--r-- | engines/pink/objects/actors/actor.cpp | 122 | ||||
-rw-r--r-- | engines/pink/objects/actors/actor.h | 62 | ||||
-rw-r--r-- | engines/pink/objects/actors/audio_info_pda_button.h | 28 | ||||
-rw-r--r-- | engines/pink/objects/actors/cursor_actor.h | 12 | ||||
-rw-r--r-- | engines/pink/objects/actors/inventory_actor.h | 16 | ||||
-rw-r--r-- | engines/pink/objects/actors/lead_actor.cpp | 554 | ||||
-rw-r--r-- | engines/pink/objects/actors/lead_actor.h | 102 | ||||
-rw-r--r-- | engines/pink/objects/actors/pda_button_actor.cpp | 16 | ||||
-rw-r--r-- | engines/pink/objects/actors/pda_button_actor.h | 16 | ||||
-rw-r--r-- | engines/pink/objects/actors/supporting_actor.cpp | 58 | ||||
-rw-r--r-- | engines/pink/objects/actors/supporting_actor.h | 32 |
11 files changed, 509 insertions, 509 deletions
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp index 4853f8d2ff..e6545f3a1f 100644 --- a/engines/pink/objects/actors/actor.cpp +++ b/engines/pink/objects/actors/actor.cpp @@ -30,20 +30,20 @@ namespace Pink { void Actor::deserialize(Archive &archive) { - NamedObject::deserialize(archive); - _page = static_cast<GamePage*>(archive.readObject()); - _actions.deserialize(archive); + NamedObject::deserialize(archive); + _page = static_cast<GamePage*>(archive.readObject()); + _actions.deserialize(archive); } void Actor::toConsole() { - debug("Actor: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } + debug("Actor: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } } Sequencer *Actor::getSequencer() const { - return _page->getSequencer(); + return _page->getSequencer(); } Action *Actor::findAction(const Common::String &name) { @@ -56,112 +56,112 @@ Action *Actor::findAction(const Common::String &name) { } GamePage *Actor::getPage() const { - return _page; + return _page; } void Actor::init(bool unk) { - if (!_action) { - _action = findAction(kIdleAction); - } + if (!_action) { + _action = findAction(kIdleAction); + } - if (!_action) { - _isActionEnded = 1; - } - else { - _isActionEnded = 0; - _action->start(unk); - } + if (!_action) { + _isActionEnded = 1; + } + else { + _isActionEnded = 0; + _action->start(unk); + } } void Actor::hide() { - setAction(kHideAction); + setAction(kHideAction); } void Actor::endAction() { - _isActionEnded = 1; + _isActionEnded = 1; } void Actor::setAction(const Common::String &name) { - Action *newAction = findAction(name); - setAction(newAction); + Action *newAction = findAction(name); + setAction(newAction); } void Actor::setAction(Action *newAction) { - if (_action) { - _isActionEnded = 1; - _action->end(); - } - _action = newAction; - if (newAction) { - _isActionEnded = 0; - _action->start(0); - } + if (_action) { + _isActionEnded = 1; + _action->end(); + } + _action = newAction; + if (newAction) { + _isActionEnded = 0; + _action->start(0); + } } void Actor::setAction(Action *newAction, bool unk) { - if (unk) { - assert(0); // want to see this - _isActionEnded = 1; - _action = newAction; - } - else { + if (unk) { + assert(0); // want to see this + _isActionEnded = 1; + _action = newAction; + } + else { setAction(newAction); } } Action *Actor::getAction() const { - return _action; + return _action; } bool Actor::isPlaying() { - return !_isActionEnded; + return !_isActionEnded; } bool Actor::initPallete(Director *director) { - for (uint i = 0; i < _actions.size(); ++i) { - if (_actions[i]->initPalette(director)) - return true; - } - return false; + for (uint i = 0; i < _actions.size(); ++i) { + if (_actions[i]->initPalette(director)) + return true; + } + return false; } void Actor::onMouseOver(Common::Point point, CursorMgr *mgr) { - mgr->setCursor(kDefaultCursor, point, Common::String()); + mgr->setCursor(kDefaultCursor, point, Common::String()); } Actor::~Actor() { - for (uint i = 0; i < _actions.size(); ++i) { - delete _actions[i]; - } + for (uint i = 0; i < _actions.size(); ++i) { + delete _actions[i]; + } } void Actor::loadState(Archive &archive) { - Common::String actionName; - actionName = archive.readString(); - _action = findAction(actionName); + Common::String actionName; + actionName = archive.readString(); + _action = findAction(actionName); } void Actor::saveState(Archive &archive) { - Common::String actionName; + Common::String actionName; - if (_action) - actionName = _action->getName(); + if (_action) + actionName = _action->getName(); - archive.writeString(actionName); + archive.writeString(actionName); } void Actor::pause() { - if (_action) - _action->pause(); + if (_action) + _action->pause(); } void Actor::unpause() { - if (_action) - _action->unpause(); + if (_action) + _action->unpause(); } void Actor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) { - cursorMgr->setCursor(kHoldingItemCursor, point, itemName); + cursorMgr->setCursor(kHoldingItemCursor, point, itemName); } } // End of namespace Pink diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h index b7650a20d0..cfbc358d70 100644 --- a/engines/pink/objects/actors/actor.h +++ b/engines/pink/objects/actors/actor.h @@ -39,49 +39,49 @@ class InventoryMgr; class Actor : public NamedObject { public: - Actor() - : _page(nullptr), _action(nullptr), - _isActionEnded(1) - {}; - ~Actor(); - virtual void deserialize(Archive &archive); + Actor() + : _page(nullptr), _action(nullptr), + _isActionEnded(1) + {}; + ~Actor(); + virtual void deserialize(Archive &archive); - virtual void toConsole(); + virtual void toConsole(); - Sequencer *getSequencer() const; - GamePage *getPage() const; - Action *getAction() const; + Sequencer *getSequencer() const; + GamePage *getPage() const; + Action *getAction() const; - bool isPlaying(); - virtual void init(bool unk); - void hide(); - void endAction(); + bool isPlaying(); + virtual void init(bool unk); + void hide(); + void endAction(); - Action *findAction(const Common::String &name); - void setAction(const Common::String &name); - void setAction(Action *newAction); - void setAction(Action *newAction, bool unk); + Action *findAction(const Common::String &name); + void setAction(const Common::String &name); + void setAction(Action *newAction); + void setAction(Action *newAction, bool unk); - void loadState(Archive &archive); - void saveState(Archive &archive); + void loadState(Archive &archive); + void saveState(Archive &archive); - bool initPallete(Director *director); + bool initPallete(Director *director); - virtual void update() {}; + virtual void update() {}; - virtual void onMouseOver(Common::Point point, CursorMgr *mgr); - virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr); + virtual void onMouseOver(Common::Point point, CursorMgr *mgr); + virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr); - virtual bool isClickable() { return 0;} + virtual bool isClickable() { return 0;} - virtual void pause(); - virtual void unpause(); + virtual void pause(); + virtual void unpause(); protected: - GamePage *_page; - Action *_action; - Array<Action*> _actions; - bool _isActionEnded; + GamePage *_page; + Action *_action; + Array<Action*> _actions; + bool _isActionEnded; }; } // End of namespace Pink diff --git a/engines/pink/objects/actors/audio_info_pda_button.h b/engines/pink/objects/actors/audio_info_pda_button.h index 63badfd64f..05c8408fe5 100644 --- a/engines/pink/objects/actors/audio_info_pda_button.h +++ b/engines/pink/objects/actors/audio_info_pda_button.h @@ -34,20 +34,20 @@ namespace Pink { class AudioInfoPDAButton : public Actor { public: - void toConsole() { - debug("CursorActor: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } - } - - void onMouseOver(Common::Point point, CursorMgr *mgr) override { - mgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); - } - - void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override { - onMouseOver(point, cursorMgr); - } + void toConsole() { + debug("CursorActor: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } + } + + void onMouseOver(Common::Point point, CursorMgr *mgr) override { + mgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); + } + + void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) override { + onMouseOver(point, cursorMgr); + } }; } // End of namespace Pink diff --git a/engines/pink/objects/actors/cursor_actor.h b/engines/pink/objects/actors/cursor_actor.h index 7c83a6b289..897728c30c 100644 --- a/engines/pink/objects/actors/cursor_actor.h +++ b/engines/pink/objects/actors/cursor_actor.h @@ -33,12 +33,12 @@ namespace Pink { //same as actor class CursorActor : public Actor { public: - void toConsole() { - debug("CursorActor: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } - } + void toConsole() { + debug("CursorActor: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } + } }; } // End of namespace Pink diff --git a/engines/pink/objects/actors/inventory_actor.h b/engines/pink/objects/actors/inventory_actor.h index 61ebbc4c09..4e6edef5a1 100644 --- a/engines/pink/objects/actors/inventory_actor.h +++ b/engines/pink/objects/actors/inventory_actor.h @@ -32,14 +32,14 @@ namespace Pink { class InventoryActor : public Actor { public: - void toConsole() { - debug("CursorActor: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } - } - - void pause() {} + void toConsole() { + debug("CursorActor: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } + } + + void pause() {} }; } // End of namespace Pink diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp index 05d9a763f4..f414cd6e30 100644 --- a/engines/pink/objects/actors/lead_actor.cpp +++ b/engines/pink/objects/actors/lead_actor.cpp @@ -34,382 +34,382 @@ namespace Pink { void LeadActor::deserialize(Archive &archive) { - _state = kReady; - Actor::deserialize(archive); - _cursorMgr = static_cast<CursorMgr*>(archive.readObject()); - _walkMgr = static_cast<WalkMgr*>(archive.readObject()); - _sequencer = static_cast<Sequencer*>(archive.readObject()); + _state = kReady; + Actor::deserialize(archive); + _cursorMgr = static_cast<CursorMgr*>(archive.readObject()); + _walkMgr = static_cast<WalkMgr*>(archive.readObject()); + _sequencer = static_cast<Sequencer*>(archive.readObject()); } void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nextPage) { - if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) { - _state = kPlayingVideo; - _page->getGame()->setNextExecutors(nextModule, nextPage); - } + if (_state == kReady || _state == kMoving || _state == kInDialog1 || _state == kInventory || _state == kPDA) { + _state = kPlayingVideo; + _page->getGame()->setNextExecutors(nextModule, nextPage); + } } void LeadActor::init(bool unk) { - if (_state == kUnk_Loading){ - _state = kReady; - } - _page->getModule()->getInventoryMgr()->setLeadActor(this); - _page->getGame()->setLeadActor(this); - Actor::init(unk); + if (_state == kUnk_Loading){ + _state = kReady; + } + _page->getModule()->getInventoryMgr()->setLeadActor(this); + _page->getGame()->setLeadActor(this); + Actor::init(unk); } void LeadActor::toConsole() { - debug("LeadActor: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } + debug("LeadActor: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } } LeadActor::State LeadActor::getState() const { - return _state; + return _state; } void LeadActor::update() { - switch (_state) { - case kReady: - _sequencer->update(); - _cursorMgr->update(); - break; - case kMoving: - _walkMgr->update(); - _cursorMgr->update(); - break; - case kInDialog1: - case kInDialog2: - _sequencer->update(); - if (!_sequencer->_context){ - _state = _nextState; - _nextState = kUnk_Loading; - } - break; - - case kInventory: - getPage()->getModule()->getInventoryMgr()->update(); - break; - case kPDA: - break; - - case kPlayingVideo: - _sequencer->update(); - if (!_sequencer->_context){ - _state = kUnk_Loading; - _page->getGame()->changeScene(_page); - } - break; - case kUnk_Loading: - break; - } + switch (_state) { + case kReady: + _sequencer->update(); + _cursorMgr->update(); + break; + case kMoving: + _walkMgr->update(); + _cursorMgr->update(); + break; + case kInDialog1: + case kInDialog2: + _sequencer->update(); + if (!_sequencer->_context){ + _state = _nextState; + _nextState = kUnk_Loading; + } + break; + + case kInventory: + getPage()->getModule()->getInventoryMgr()->update(); + break; + case kPDA: + break; + + case kPlayingVideo: + _sequencer->update(); + if (!_sequencer->_context){ + _state = kUnk_Loading; + _page->getGame()->changeScene(_page); + } + break; + case kUnk_Loading: + break; + } } void LeadActor::onKeyboardButtonClick(Common::KeyCode code) { - switch(_state) { - case kMoving: - switch (code){ - case Common::KEYCODE_ESCAPE: - // set unk variables - // Fall Through intended - case Common::KEYCODE_SPACE: - //skip walking animation - default: - break; - } - break; - case kInDialog1: - case kInDialog2: - case kPlayingVideo: - switch (code) { - case Common::KEYCODE_SPACE: - case Common::KEYCODE_RIGHT: - _sequencer->skipSubSequence(); - break; - case Common::KEYCODE_ESCAPE: - _sequencer->skipToLastSubSequence(); - break; - case Common::KEYCODE_LEFT: - _sequencer->restartSequence(); - break; - default: - break; - } - break; - default: - break; - } + switch(_state) { + case kMoving: + switch (code){ + case Common::KEYCODE_ESCAPE: + // set unk variables + // Fall Through intended + case Common::KEYCODE_SPACE: + //skip walking animation + default: + break; + } + break; + case kInDialog1: + case kInDialog2: + case kPlayingVideo: + switch (code) { + case Common::KEYCODE_SPACE: + case Common::KEYCODE_RIGHT: + _sequencer->skipSubSequence(); + break; + case Common::KEYCODE_ESCAPE: + _sequencer->skipToLastSubSequence(); + break; + case Common::KEYCODE_LEFT: + _sequencer->restartSequence(); + break; + default: + break; + } + break; + default: + break; + } } void LeadActor::start(bool isHandler) { - if (isHandler && _state != kPlayingVideo){ - _state = kInDialog1; - _nextState = kReady; - } - forceUpdateCursor(); + if (isHandler && _state != kPlayingVideo){ + _state = kInDialog1; + _nextState = kReady; + } + forceUpdateCursor(); } void LeadActor::onMouseMove(Common::Point point) { - if (_state != kPDA) - updateCursor(point); - else error("pda is not supported"); + if (_state != kPDA) + updateCursor(point); + else error("pda is not supported"); } void LeadActor::updateCursor(Common::Point point) { - switch (_state) { - case kReady: - case kMoving: { - Director *director = _page->getGame()->getDirector(); - Actor *actor = director->getActorByPoint(point); - InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem(); - if (_isHaveItem) { - if (actor) { - actor->onHover(point, item->getName(), _cursorMgr); - } - else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName()); - } - else if (actor) - actor->onMouseOver(point, _cursorMgr); - else _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); - break; - } - case kInDialog1: - case kInDialog2: - case kPlayingVideo: - _cursorMgr->setCursor(kNotClickableCursor, point, Common::String()); - break; - case kPDA: - case kInventory: - _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); - break; - default: - break; - } + switch (_state) { + case kReady: + case kMoving: { + Director *director = _page->getGame()->getDirector(); + Actor *actor = director->getActorByPoint(point); + InventoryItem *item = _page->getModule()->getInventoryMgr()->getCurrentItem(); + if (_isHaveItem) { + if (actor) { + actor->onHover(point, item->getName(), _cursorMgr); + } + else _cursorMgr->setCursor(kHoldingItemCursor, point, item->getName()); + } + else if (actor) + actor->onMouseOver(point, _cursorMgr); + else _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); + break; + } + case kInDialog1: + case kInDialog2: + case kPlayingVideo: + _cursorMgr->setCursor(kNotClickableCursor, point, Common::String()); + break; + case kPDA: + case kInventory: + _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); + break; + default: + break; + } } void LeadActor::onLeftButtonClick(Common::Point point) { - InventoryMgr *invMgr = _page->getModule()->getInventoryMgr(); - - switch (_state) { - case kReady: - case kMoving: { - Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point); - - if (this == actor) { - onClick(); - return; - } - - _recipient = dynamic_cast<SupportingActor*>(actor); - if (actor->isClickable() && isInteractingWith(_recipient)) { - WalkLocation *location = getWalkDestination(); - if (location) { - _state = kMoving; - _nextState = kInDialog1; - _walkMgr->start(location); - } - else if (_state == kReady){ - if (_isHaveItem) - sendUseClickMessage(_recipient); - else sendLeftClickMessage(_recipient); - } - } - - break; - } - case kPDA: - - break; - case kInventory: - invMgr->onClick(point); - break; - default: - break; - } + InventoryMgr *invMgr = _page->getModule()->getInventoryMgr(); + + switch (_state) { + case kReady: + case kMoving: { + Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point); + + if (this == actor) { + onClick(); + return; + } + + _recipient = dynamic_cast<SupportingActor*>(actor); + if (actor->isClickable() && isInteractingWith(_recipient)) { + WalkLocation *location = getWalkDestination(); + if (location) { + _state = kMoving; + _nextState = kInDialog1; + _walkMgr->start(location); + } + else if (_state == kReady){ + if (_isHaveItem) + sendUseClickMessage(_recipient); + else sendLeftClickMessage(_recipient); + } + } + + break; + } + case kPDA: + + break; + case kInventory: + invMgr->onClick(point); + break; + default: + break; + } } void LeadActor::onMouseOver(Common::Point point, CursorMgr *mgr) { - if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems()) - _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); - else Actor::onMouseOver(point, mgr); + if (_page->getModule()->getInventoryMgr()->isPinkOwnsAnyItems()) + _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); + else Actor::onMouseOver(point, mgr); } void LeadActor::onWalkEnd() { - State oldNextState = _nextState; - _state = kReady; - _nextState = kUnk_Loading; - if (_recipient && oldNextState == kInDialog1){ - if (_isHaveItem) - sendUseClickMessage(_recipient); - else sendLeftClickMessage(_recipient); - } + State oldNextState = _nextState; + _state = kReady; + _nextState = kUnk_Loading; + if (_recipient && oldNextState == kInDialog1){ + if (_isHaveItem) + sendUseClickMessage(_recipient); + else sendLeftClickMessage(_recipient); + } } bool LeadActor::sendUseClickMessage(SupportingActor *actor) { - InventoryMgr *mgr = _page->getModule()->getInventoryMgr(); - _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo; - _state = kInDialog1; - InventoryItem *item = mgr->getCurrentItem(); - actor->onUseClickMessage(mgr->getCurrentItem(), mgr); - if (item->getCurrentOwner() != this->_name) - _isHaveItem = false; - return true; + InventoryMgr *mgr = _page->getModule()->getInventoryMgr(); + _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo; + _state = kInDialog1; + InventoryItem *item = mgr->getCurrentItem(); + actor->onUseClickMessage(mgr->getCurrentItem(), mgr); + if (item->getCurrentOwner() != this->_name) + _isHaveItem = false; + return true; } bool LeadActor::sendLeftClickMessage(SupportingActor *actor) { - _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo; - _state = kInDialog1; - return actor->onLeftClickMessage(); + _nextState = _state != kPlayingVideo ? kReady : kPlayingVideo; + _state = kInDialog1; + return actor->onLeftClickMessage(); } void LeadActor::onClick() { - if (_isHaveItem) { - _isHaveItem = false; - _nextState = (_state != kMoving) ? - kUnk_Loading : kReady; - } - else { - if (_state == kMoving) { - _recipient = nullptr; - _nextState = kReady; - } - if (_page->getModule()->getInventoryMgr()->start(1)){ - _stateCopy = _state; - _state = kInventory; - _page->pause(); - } - } + if (_isHaveItem) { + _isHaveItem = false; + _nextState = (_state != kMoving) ? + kUnk_Loading : kReady; + } + else { + if (_state == kMoving) { + _recipient = nullptr; + _nextState = kReady; + } + if (_page->getModule()->getInventoryMgr()->start(1)){ + _stateCopy = _state; + _state = kInventory; + _page->pause(); + } + } } LeadActor::LeadActor() - : _state(kReady), _nextState(kReady), - _isHaveItem(false), _recipient(nullptr), - _cursorMgr(nullptr), _walkMgr(nullptr), - _sequencer(nullptr) + : _state(kReady), _nextState(kReady), + _isHaveItem(false), _recipient(nullptr), + _cursorMgr(nullptr), _walkMgr(nullptr), + _sequencer(nullptr) {} void LeadActor::onInventoryClosed(bool isItemClicked) { - _isHaveItem = isItemClicked; - _state = _stateCopy; - _stateCopy = kUnk_Loading; - _page->unpause(); - forceUpdateCursor(); + _isHaveItem = isItemClicked; + _state = _stateCopy; + _stateCopy = kUnk_Loading; + _page->unpause(); + forceUpdateCursor(); } void LeadActor::forceUpdateCursor() { - Common::Point point = _page->getGame()->getEventManager()->getMousePos(); - updateCursor(point); + Common::Point point = _page->getGame()->getEventManager()->getMousePos(); + updateCursor(point); } WalkLocation *LeadActor::getWalkDestination() { - return _walkMgr->findLocation(_recipient->getLocation()); + return _walkMgr->findLocation(_recipient->getLocation()); } bool LeadActor::isInteractingWith(SupportingActor *actor) { - if (!_isHaveItem) - return actor->isLeftClickHandlers(); + if (!_isHaveItem) + return actor->isLeftClickHandlers(); - return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()); + return actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem()); } void ParlSqPink::toConsole() { - debug("ParlSqPink: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } + debug("ParlSqPink: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } } WalkLocation *ParlSqPink::getWalkDestination() { - if (_recipient->getName() == kBoy && - _page->checkValueOfVariable(kBoyBlocked, kUndefined)) - { - return _walkMgr->findLocation(kSirBaldley); - } - return LeadActor::getWalkDestination(); + if (_recipient->getName() == kBoy && + _page->checkValueOfVariable(kBoyBlocked, kUndefined)) + { + return _walkMgr->findLocation(kSirBaldley); + } + return LeadActor::getWalkDestination(); } PubPink::PubPink() : - LeadActor(), _round(0) + LeadActor(), _round(0) {} void PubPink::toConsole() { - debug("PubPink: _name = %s", _name.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } + debug("PubPink: _name = %s", _name.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } } bool PubPink::playingMiniGame() { - return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") || - _page->checkValueOfVariable(kFoodPuzzle, kUndefined)); + return !(_page->checkValueOfVariable(kFoodPuzzle, "TRUE") || + _page->checkValueOfVariable(kFoodPuzzle, kUndefined)); } void PubPink::onClick() { - if (!playingMiniGame()) - LeadActor::onClick(); + if (!playingMiniGame()) + LeadActor::onClick(); } void PubPink::updateCursor(Common::Point point) { - if (playingMiniGame()) { - SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point)); - if (_state == kReady && - actor && - actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) - { - _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); - } - else _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); - } - else LeadActor::updateCursor(point); + if (playingMiniGame()) { + SupportingActor *actor = dynamic_cast<SupportingActor*>(_page->getGame()->getDirector()->getActorByPoint(point)); + if (_state == kReady && + actor && + actor->isUseClickHandlers(_page->getModule()->getInventoryMgr()->getCurrentItem())) + { + _cursorMgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); + } + else _cursorMgr->setCursor(kDefaultCursor, point, Common::String()); + } + else LeadActor::updateCursor(point); } WalkLocation *PubPink::getWalkDestination() { - if (playingMiniGame()) - return nullptr; + if (playingMiniGame()) + return nullptr; - if (_recipient->getName() == kJackson && - !_page->checkValueOfVariable(kDrunkLocation, kBolted)) - { - return _walkMgr->findLocation(_page->findActor(kDrunk)->getName()); - } + if (_recipient->getName() == kJackson && + !_page->checkValueOfVariable(kDrunkLocation, kBolted)) + { + return _walkMgr->findLocation(_page->findActor(kDrunk)->getName()); + } - return LeadActor::getWalkDestination(); + return LeadActor::getWalkDestination(); } bool PubPink::sendUseClickMessage(SupportingActor *actor) { if (!LeadActor::sendUseClickMessage(actor) && - playingMiniGame()) { - _nextState = _state; - _state = kInDialog1; - - const char *roundName; - switch (_round++ % 3) { - case 0: - roundName = kFirstRound; - break; - case 1: - roundName = kSecondRound; - break; - case 2: - roundName = kThirdRound; - break; - default: - roundName = nullptr; - assert(0); - break; - } - _sequencer->authorSequence(_sequencer->findSequence(roundName), 0); + playingMiniGame()) { + _nextState = _state; + _state = kInDialog1; + + const char *roundName; + switch (_round++ % 3) { + case 0: + roundName = kFirstRound; + break; + case 1: + roundName = kSecondRound; + break; + case 2: + roundName = kThirdRound; + break; + default: + roundName = nullptr; + assert(0); + break; + } + _sequencer->authorSequence(_sequencer->findSequence(roundName), 0); } if (playingMiniGame()) - _isHaveItem = true; + _isHaveItem = true; return true; } void PubPink::onVariableSet() { - if (playingMiniGame()) - _isHaveItem = true; + if (playingMiniGame()) + _isHaveItem = true; } } // End of namespace Pink diff --git a/engines/pink/objects/actors/lead_actor.h b/engines/pink/objects/actors/lead_actor.h index b6f91acabf..7dff2e86df 100644 --- a/engines/pink/objects/actors/lead_actor.h +++ b/engines/pink/objects/actors/lead_actor.h @@ -40,89 +40,89 @@ class InventoryItem; class LeadActor : public Actor { public: - LeadActor(); - enum State { - kReady = 0, - kMoving = 1, - kInDialog1 = 2, //??? - kInventory = 3, - kPDA = 4, - kInDialog2 = 5,//??? - kPlayingVideo = 6, // ??? - kUnk_Loading = 7// ???? - }; + LeadActor(); + enum State { + kReady = 0, + kMoving = 1, + kInDialog1 = 2, //??? + kInventory = 3, + kPDA = 4, + kInDialog2 = 5,//??? + kPlayingVideo = 6, // ??? + kUnk_Loading = 7// ???? + }; - virtual void deserialize(Archive &archive); + virtual void deserialize(Archive &archive); - virtual void toConsole(); + virtual void toConsole(); - void setNextExecutors (Common::String &nextModule, Common::String &nextPage); - virtual void init(bool unk); + void setNextExecutors (Common::String &nextModule, Common::String &nextPage); + virtual void init(bool unk); - State getState() const; + State getState() const; - void start(bool isHandler); - void update(); + void start(bool isHandler); + void update(); - void onKeyboardButtonClick(Common::KeyCode code); - void onLeftButtonClick(Common::Point point); - void onMouseMove(Common::Point point); - void onWalkEnd(); - virtual void onClick(); - void onInventoryClosed(bool isItemClicked); - virtual void onVariableSet() {}; + void onKeyboardButtonClick(Common::KeyCode code); + void onLeftButtonClick(Common::Point point); + void onMouseMove(Common::Point point); + void onWalkEnd(); + virtual void onClick(); + void onInventoryClosed(bool isItemClicked); + virtual void onVariableSet() {}; - virtual void onMouseOver(Common::Point point, CursorMgr *mgr); + virtual void onMouseOver(Common::Point point, CursorMgr *mgr); - bool isInteractingWith(SupportingActor *actor); + bool isInteractingWith(SupportingActor *actor); protected: - virtual void updateCursor(Common::Point point); - void forceUpdateCursor(); + virtual void updateCursor(Common::Point point); + void forceUpdateCursor(); - virtual bool sendUseClickMessage(SupportingActor *actor); - bool sendLeftClickMessage(SupportingActor *actor); + virtual bool sendUseClickMessage(SupportingActor *actor); + bool sendLeftClickMessage(SupportingActor *actor); - virtual WalkLocation *getWalkDestination(); + virtual WalkLocation *getWalkDestination(); - State _state; - State _nextState; - State _stateCopy; + State _state; + State _nextState; + State _stateCopy; - bool _isHaveItem; + bool _isHaveItem; - SupportingActor *_recipient; + SupportingActor *_recipient; - CursorMgr *_cursorMgr; - WalkMgr *_walkMgr; - Sequencer *_sequencer; + CursorMgr *_cursorMgr; + WalkMgr *_walkMgr; + Sequencer *_sequencer; }; class ParlSqPink : public LeadActor { public: - virtual WalkLocation *getWalkDestination(); - void toConsole(); + virtual WalkLocation *getWalkDestination(); + void toConsole(); }; class PubPink : public LeadActor { public: - PubPink(); + PubPink(); - void toConsole(); + void toConsole(); - virtual void onClick(); - virtual void onVariableSet(); + virtual void onClick(); + virtual void onVariableSet(); private: - int _round; + int _round; - virtual bool sendUseClickMessage(SupportingActor *actor); - virtual void updateCursor(Common::Point point); - virtual WalkLocation *getWalkDestination(); + virtual bool sendUseClickMessage(SupportingActor *actor); + virtual void updateCursor(Common::Point point); + virtual WalkLocation *getWalkDestination(); - bool playingMiniGame(); + bool playingMiniGame(); }; diff --git a/engines/pink/objects/actors/pda_button_actor.cpp b/engines/pink/objects/actors/pda_button_actor.cpp index 1057a060e4..65e3f7ba21 100644 --- a/engines/pink/objects/actors/pda_button_actor.cpp +++ b/engines/pink/objects/actors/pda_button_actor.cpp @@ -25,18 +25,18 @@ namespace Pink { void PDAButtonActor::deserialize(Archive &archive) { - Actor::deserialize(archive); - _hideOnStop = (bool) archive.readDWORD(); - _opaque = (bool) archive.readDWORD(); + Actor::deserialize(archive); + _hideOnStop = (bool) archive.readDWORD(); + _opaque = (bool) archive.readDWORD(); - int comm = archive.readDWORD(); - assert(comm <= 4); - _command = (Command) comm; + int comm = archive.readDWORD(); + assert(comm <= 4); + _command = (Command) comm; } void PDAButtonActor::toConsole() { - debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u", - _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command); + debug("PDAButtonActor: _name = %s, _x = %u _y = %u _hideOnStop = %u, _opaque = %u, _command = %u", + _name.c_str(), _x, _y, _hideOnStop, _opaque, (int) _command); } } // End of namespace Pink diff --git a/engines/pink/objects/actors/pda_button_actor.h b/engines/pink/objects/actors/pda_button_actor.h index c3cd845886..5e7d53b4b4 100644 --- a/engines/pink/objects/actors/pda_button_actor.h +++ b/engines/pink/objects/actors/pda_button_actor.h @@ -29,19 +29,19 @@ namespace Pink { class PDAButtonActor : public Actor { public: - enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4}; + enum Command {Null = 0, GoToPage = 1, Close = 2, Unk = 4}; - void deserialize(Archive &archive) override; - void toConsole() override; + void deserialize(Archive &archive) override; + void toConsole() override; private: - int _x; - int _y; + int _x; + int _y; - bool _hideOnStop; - bool _opaque; + bool _hideOnStop; + bool _opaque; - Command _command; + Command _command; }; } // End of namespace Pink diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp index 9c06dee3fc..3ba10366ed 100644 --- a/engines/pink/objects/actors/supporting_actor.cpp +++ b/engines/pink/objects/actors/supporting_actor.cpp @@ -30,64 +30,64 @@ namespace Pink { void SupportingActor::deserialize(Archive &archive) { - Actor::deserialize(archive); - _location = archive.readString(); - _pdaLink = archive.readString(); - _cursor = archive.readString(); - _handlerMgr.deserialize(archive); + Actor::deserialize(archive); + _location = archive.readString(); + _pdaLink = archive.readString(); + _cursor = archive.readString(); + _handlerMgr.deserialize(archive); } void SupportingActor::toConsole() { - debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s", - _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str()); - for (uint i = 0; i < _actions.size(); ++i) { - _actions[i]->toConsole(); - } - _handlerMgr.toConsole(); + debug("SupportingActor: _name = %s, _location=%s, _pdaLink=%s, _cursor=%s", + _name.c_str(), _location.c_str(), _pdaLink.c_str(), _cursor.c_str()); + for (uint i = 0; i < _actions.size(); ++i) { + _actions[i]->toConsole(); + } + _handlerMgr.toConsole(); } void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) { - if (isLeftClickHandlers()){ - if (!_cursor.empty()){ - mgr->setCursor(_cursor, point); - } - else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); - } - else Actor::onMouseOver(point, mgr); + if (isLeftClickHandlers()){ + if (!_cursor.empty()){ + mgr->setCursor(_cursor, point); + } + else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String()); + } + else Actor::onMouseOver(point, mgr); } bool SupportingActor::isLeftClickHandlers() { - return _handlerMgr.isLeftClickHandler(this); + return _handlerMgr.isLeftClickHandler(this); } bool SupportingActor::isUseClickHandlers(InventoryItem *item) { - return _handlerMgr.isUseClickHandler(this, item->getName()); + return _handlerMgr.isUseClickHandler(this, item->getName()); } void SupportingActor::onTimerMessage() { - _handlerMgr.onTimerMessage(this); + _handlerMgr.onTimerMessage(this); } bool SupportingActor::onLeftClickMessage() { - return _handlerMgr.onLeftClickMessage(this); + return _handlerMgr.onLeftClickMessage(this); } bool SupportingActor::onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) { - return _handlerMgr.onUseClickMessage(this, item, mgr); + return _handlerMgr.onUseClickMessage(this, item, mgr); } const Common::String &SupportingActor::getLocation() const { - return _location; + return _location; } SupportingActor::~SupportingActor() {} void SupportingActor::onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr) { - Common::String item = itemName; - if (_handlerMgr.isUseClickHandler(this, itemName)) { - item += kClickable; - } - Actor::onHover(point, item, cursorMgr); + Common::String item = itemName; + if (_handlerMgr.isUseClickHandler(this, itemName)) { + item += kClickable; + } + Actor::onHover(point, item, cursorMgr); } } // End of namespace Pink diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h index eecee3a642..d47959dfa9 100644 --- a/engines/pink/objects/actors/supporting_actor.h +++ b/engines/pink/objects/actors/supporting_actor.h @@ -33,30 +33,30 @@ class InventoryMgr; class SupportingActor : public Actor { public: - virtual ~SupportingActor(); - virtual void deserialize(Archive &archive); - virtual void toConsole(); + virtual ~SupportingActor(); + virtual void deserialize(Archive &archive); + virtual void toConsole(); - virtual void onMouseOver(Common::Point point, CursorMgr *mgr); + virtual void onMouseOver(Common::Point point, CursorMgr *mgr); - virtual bool isClickable() { return 1; } - bool isLeftClickHandlers(); - bool isUseClickHandlers(InventoryItem *item); + virtual bool isClickable() { return 1; } + bool isLeftClickHandlers(); + bool isUseClickHandlers(InventoryItem *item); - void onTimerMessage(); - bool onLeftClickMessage(); - bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr); + void onTimerMessage(); + bool onLeftClickMessage(); + bool onUseClickMessage(InventoryItem *item, InventoryMgr *mgr); - virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr); + virtual void onHover(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr); - const Common::String &getLocation() const; + const Common::String &getLocation() const; private: - HandlerMgr _handlerMgr; - Common::String _location; - Common::String _pdaLink; - Common::String _cursor; + HandlerMgr _handlerMgr; + Common::String _location; + Common::String _pdaLink; + Common::String _cursor; }; } // End of namespace Pink |