aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/actors
diff options
context:
space:
mode:
authorwhiterandrek2018-05-22 11:58:02 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commite98c14c3d7d790f6ba77ab4d4925b608c55e2e22 (patch)
tree00b613617132ce06f622054786f63ed8396db9ae /engines/pink/objects/actors
parentd7f09d4c3cbfca7472856ca5a3e14a8e55255451 (diff)
downloadscummvm-rg350-e98c14c3d7d790f6ba77ab4d4925b608c55e2e22.tar.gz
scummvm-rg350-e98c14c3d7d790f6ba77ab4d4925b608c55e2e22.tar.bz2
scummvm-rg350-e98c14c3d7d790f6ba77ab4d4925b608c55e2e22.zip
PINK: fix formatting
Diffstat (limited to 'engines/pink/objects/actors')
-rw-r--r--engines/pink/objects/actors/actor.cpp12
-rw-r--r--engines/pink/objects/actors/actor.h7
-rw-r--r--engines/pink/objects/actors/lead_actor.cpp284
-rw-r--r--engines/pink/objects/actors/supporting_actor.cpp14
-rw-r--r--engines/pink/objects/actors/supporting_actor.h1
5 files changed, 150 insertions, 168 deletions
diff --git a/engines/pink/objects/actors/actor.cpp b/engines/pink/objects/actors/actor.cpp
index e6545f3a1f..abcb66502e 100644
--- a/engines/pink/objects/actors/actor.cpp
+++ b/engines/pink/objects/actors/actor.cpp
@@ -48,9 +48,8 @@ Sequencer *Actor::getSequencer() const {
Action *Actor::findAction(const Common::String &name) {
for (uint i = 0; i < _actions.size(); ++i) {
- if (_actions[i]->getName() == name) {
+ if (_actions[i]->getName() == name)
return _actions[i];
- }
}
return nullptr;
}
@@ -60,14 +59,12 @@ GamePage *Actor::getPage() const {
}
void Actor::init(bool unk) {
- if (!_action) {
+ if (!_action)
_action = findAction(kIdleAction);
- }
if (!_action) {
_isActionEnded = 1;
- }
- else {
+ } else {
_isActionEnded = 0;
_action->start(unk);
}
@@ -103,8 +100,7 @@ void Actor::setAction(Action *newAction, bool unk) {
assert(0); // want to see this
_isActionEnded = 1;
_action = newAction;
- }
- else {
+ } else {
setAction(newAction);
}
}
diff --git a/engines/pink/objects/actors/actor.h b/engines/pink/objects/actors/actor.h
index cfbc358d70..b4fe437cf5 100644
--- a/engines/pink/objects/actors/actor.h
+++ b/engines/pink/objects/actors/actor.h
@@ -41,8 +41,7 @@ class Actor : public NamedObject {
public:
Actor()
: _page(nullptr), _action(nullptr),
- _isActionEnded(1)
- {};
+ _isActionEnded(1) {};
~Actor();
virtual void deserialize(Archive &archive);
@@ -72,7 +71,7 @@ public:
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();
@@ -80,7 +79,7 @@ public:
protected:
GamePage *_page;
Action *_action;
- Array<Action*> _actions;
+ Array<Action *> _actions;
bool _isActionEnded;
};
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp
index f414cd6e30..484871a6e9 100644
--- a/engines/pink/objects/actors/lead_actor.cpp
+++ b/engines/pink/objects/actors/lead_actor.cpp
@@ -49,9 +49,9 @@ void LeadActor::setNextExecutors(Common::String &nextModule, Common::String &nex
}
void LeadActor::init(bool unk) {
- if (_state == kUnk_Loading){
+ if (_state == kUnk_Loading)
_state = kReady;
- }
+
_page->getModule()->getInventoryMgr()->setLeadActor(this);
_page->getGame()->setLeadActor(this);
Actor::init(unk);
@@ -70,79 +70,79 @@ LeadActor::State LeadActor::getState() const {
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;
+ 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;
+ default:
+ 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;
- }
+ 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;
- 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;
+ 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){
+ if (isHandler && _state != kPlayingVideo) {
_state = kInDialog1;
_nextState = kReady;
}
@@ -152,38 +152,39 @@ void LeadActor::start(bool isHandler) {
void LeadActor::onMouseMove(Common::Point point) {
if (_state != kPDA)
updateCursor(point);
- else error("pda is not supported");
+ 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:
+ 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;
- default:
- break;
+ 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;
}
}
@@ -191,8 +192,8 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
InventoryMgr *invMgr = _page->getModule()->getInventoryMgr();
switch (_state) {
- case kReady:
- case kMoving: {
+ case kReady:
+ case kMoving: {
Actor *actor = _page->getGame()->getDirector()->getActorByPoint(point);
if (this == actor) {
@@ -200,48 +201,50 @@ void LeadActor::onLeftButtonClick(Common::Point point) {
return;
}
- _recipient = dynamic_cast<SupportingActor*>(actor);
+ _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){
+ } else if (_state == kReady) {
if (_isHaveItem)
sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
+ else
+ sendLeftClickMessage(_recipient);
}
}
break;
- }
- case kPDA:
+ }
+ case kPDA:
- break;
- case kInventory:
- invMgr->onClick(point);
- break;
- default:
- break;
+ 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);
+ else
+ Actor::onMouseOver(point, mgr);
}
void LeadActor::onWalkEnd() {
State oldNextState = _nextState;
_state = kReady;
_nextState = kUnk_Loading;
- if (_recipient && oldNextState == kInDialog1){
+ if (_recipient && oldNextState == kInDialog1) {
if (_isHaveItem)
sendUseClickMessage(_recipient);
- else sendLeftClickMessage(_recipient);
+ else
+ sendLeftClickMessage(_recipient);
}
}
@@ -267,13 +270,12 @@ void LeadActor::onClick() {
_isHaveItem = false;
_nextState = (_state != kMoving) ?
kUnk_Loading : kReady;
- }
- else {
+ } else {
if (_state == kMoving) {
_recipient = nullptr;
_nextState = kReady;
}
- if (_page->getModule()->getInventoryMgr()->start(1)){
+ if (_page->getModule()->getInventoryMgr()->start(1)) {
_stateCopy = _state;
_state = kInventory;
_page->pause();
@@ -282,11 +284,9 @@ void LeadActor::onClick() {
}
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;
@@ -320,17 +320,14 @@ void ParlSqPink::toConsole() {
}
WalkLocation *ParlSqPink::getWalkDestination() {
- if (_recipient->getName() == kBoy &&
- _page->checkValueOfVariable(kBoyBlocked, kUndefined))
- {
+ 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());
@@ -352,13 +349,11 @@ void PubPink::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());
+ 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);
}
@@ -367,36 +362,31 @@ WalkLocation *PubPink::getWalkDestination() {
if (playingMiniGame())
return nullptr;
- if (_recipient->getName() == kJackson &&
- !_page->checkValueOfVariable(kDrunkLocation, kBolted))
- {
+ if (_recipient->getName() == kJackson && !_page->checkValueOfVariable(kDrunkLocation, kBolted))
return _walkMgr->findLocation(_page->findActor(kDrunk)->getName());
- }
return LeadActor::getWalkDestination();
}
bool PubPink::sendUseClickMessage(SupportingActor *actor) {
- if (!LeadActor::sendUseClickMessage(actor) &&
- playingMiniGame()) {
+ 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;
+ case 0:
+ roundName = kFirstRound;
+ break;
+ case 1:
+ roundName = kSecondRound;
+ break;
+ case 2:
+ roundName = kThirdRound;
+ break;
+ default:
+ roundName = nullptr;
+ assert(0);
}
_sequencer->authorSequence(_sequencer->findSequence(roundName), 0);
}
diff --git a/engines/pink/objects/actors/supporting_actor.cpp b/engines/pink/objects/actors/supporting_actor.cpp
index 3ba10366ed..9e5eaa6786 100644
--- a/engines/pink/objects/actors/supporting_actor.cpp
+++ b/engines/pink/objects/actors/supporting_actor.cpp
@@ -48,12 +48,13 @@ void SupportingActor::toConsole() {
void SupportingActor::onMouseOver(Common::Point point, CursorMgr *mgr) {
if (isLeftClickHandlers()){
- if (!_cursor.empty()){
+ if (!_cursor.empty())
mgr->setCursor(_cursor, point);
- }
- else mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
+ else
+ mgr->setCursor(kClickableFirstFrameCursor, point, Common::String());
}
- else Actor::onMouseOver(point, mgr);
+ else
+ Actor::onMouseOver(point, mgr);
}
bool SupportingActor::isLeftClickHandlers() {
@@ -80,13 +81,10 @@ const Common::String &SupportingActor::getLocation() const {
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)) {
+ if (_handlerMgr.isUseClickHandler(this, itemName))
item += kClickable;
- }
Actor::onHover(point, item, cursorMgr);
}
diff --git a/engines/pink/objects/actors/supporting_actor.h b/engines/pink/objects/actors/supporting_actor.h
index d47959dfa9..d9b77f7498 100644
--- a/engines/pink/objects/actors/supporting_actor.h
+++ b/engines/pink/objects/actors/supporting_actor.h
@@ -33,7 +33,6 @@ class InventoryMgr;
class SupportingActor : public Actor {
public:
- virtual ~SupportingActor();
virtual void deserialize(Archive &archive);
virtual void toConsole();