ScummVM API documentation
lead_actor.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef PINK_LEAD_ACTOR_H
23 #define PINK_LEAD_ACTOR_H
24 
25 #include "common/events.h"
26 #include "common/rect.h"
27 #include "common/keyboard.h"
28 
29 #include "pink/objects/actors/actor.h"
30 #include "pink/audio_info_mgr.h"
31 
32 namespace Pink {
33 
34 class CursorMgr;
35 class WalkMgr;
36 class WalkLocation;
37 class Sequencer;
38 
39 class SupportingActor;
40 class InventoryItem;
41 
42 class LeadActor : public Actor {
43 public:
44  LeadActor();
45 
46  enum State {
47  kReady = 0,
48  kMoving = 1,
49  kPlayingSequence = 2,
50  kInventory = 3,
51  kPDA = 4,
52  kPlayingExitSequence = 6,
53  kUndefined = 7
54  };
55 
56  void deserialize(Archive &archive) override;
57 
58  void toConsole() const override;
59 
60  void loadState(Archive &archive);
61  void saveState(Archive &archive);
62 
63  void init(bool paused) override;
64 
65  void start(bool isHandler);
66 
67  void update();
68 
69  void loadPDA(const Common::String &pageName);
70 
71  void onActionClick(Common::CustomEventType action);
72  void onLeftButtonClick(Common::Point point);
73  void onLeftButtonUp();
74  virtual void onRightButtonClick(Common::Point point);
75 
76  void onMouseMove(Common::Point point);
77 
78  void onMouseOverWithItem(Common::Point point, const Common::String &itemName, Pink::CursorMgr *cursorMgr) override;
79  void onMouseOver(Common::Point point, CursorMgr *mgr) override;
80 
81  void onLeftClickMessage() override;
82  virtual void onVariableSet() {}
83  void onInventoryClosed(bool isItemClicked);
84  void onWalkEnd(const Common::String &stopName);
85  void onPDAClose();
86 
87  bool isInteractingWith(const Actor *actor) const;
88 
89  void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
90 
91  State getState() const { return _state; }
92 
93  AudioInfoMgr *getAudioInfoMgr() { return &_audioInfoMgr; }
94 
95  Actor *getActorByPoint(Common::Point point);
96 
97  Actor *findActor(const Common::String &name);
98 
99 protected:
100  void forceUpdateCursor();
101 
102  virtual void updateCursor(Common::Point point);
103 
104  virtual void sendUseClickMessage(Actor *actor);
105  void sendLeftClickMessage(Actor *actor);
106 
107  virtual WalkLocation *getWalkDestination();
108 
109  void startInventory(bool paused);
110  bool startWalk();
111 
112  void cancelInteraction();
113 
114  Actor *_recipient;
115 
116  CursorMgr *_cursorMgr;
117  WalkMgr *_walkMgr;
118  Sequencer *_sequencer;
119 
120  AudioInfoMgr _audioInfoMgr;
121 
122  State _state;
123  State _nextState;
124  State _stateBeforeInventory;
125  State _stateBeforePDA;
126 
127  bool _isHaveItem;
128 };
129 
130 
131 class ParlSqPink : public LeadActor {
132 public:
133  void toConsole() const override;
134 
135 protected:
136  WalkLocation *getWalkDestination() override;
137 };
138 
139 class PubPink : public LeadActor {
140 public:
141  void toConsole() const override;
142 
143  void onRightButtonClick(Common::Point point) override;
144 
145  void onLeftClickMessage() override;
146  void onVariableSet() override;
147 
148 protected:
149  void updateCursor(Common::Point point) override;
150 
151  void sendUseClickMessage(Actor *actor) override;
152 
153  WalkLocation *getWalkDestination() override;
154 
155 private:
156  bool playingMiniGame();
157 };
158 
159 
160 } // End of namespace Pink
161 
162 #endif
Definition: archive.h:39
Definition: cursor_mgr.h:35
Definition: str.h:59
Definition: audio_info_mgr.h:33
Definition: walk_location.h:28
Definition: sequencer.h:36
uint32 CustomEventType
Definition: events.h:204
Definition: archive.h:35
Definition: lead_actor.h:42
Definition: lead_actor.h:131
Definition: rect.h:144
Definition: actor.h:39
Definition: walk_mgr.h:42
Definition: lead_actor.h:139