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/rect.h"
26 #include "common/keyboard.h"
27 
28 #include "pink/objects/actors/actor.h"
29 #include "pink/audio_info_mgr.h"
30 
31 namespace Pink {
32 
33 class CursorMgr;
34 class WalkMgr;
35 class WalkLocation;
36 class Sequencer;
37 
38 class SupportingActor;
39 class InventoryItem;
40 
41 class LeadActor : public Actor {
42 public:
43  LeadActor();
44 
45  enum State {
46  kReady = 0,
47  kMoving = 1,
48  kPlayingSequence = 2,
49  kInventory = 3,
50  kPDA = 4,
51  kPlayingExitSequence = 6,
52  kUndefined = 7
53  };
54 
55  void deserialize(Archive &archive) override;
56 
57  void toConsole() const override;
58 
59  void loadState(Archive &archive);
60  void saveState(Archive &archive);
61 
62  void init(bool paused) override;
63 
64  void start(bool isHandler);
65 
66  void update();
67 
68  void loadPDA(const Common::String &pageName);
69 
70  void onKeyboardButtonClick(Common::KeyCode code);
71  void onLeftButtonClick(Common::Point point);
72  void onLeftButtonUp();
73  virtual void onRightButtonClick(Common::Point point);
74 
75  void onMouseMove(Common::Point point);
76 
77  void onMouseOverWithItem(Common::Point point, const Common::String &itemName, Pink::CursorMgr *cursorMgr) override;
78  void onMouseOver(Common::Point point, CursorMgr *mgr) override;
79 
80  void onLeftClickMessage() override;
81  virtual void onVariableSet() {}
82  void onInventoryClosed(bool isItemClicked);
83  void onWalkEnd(const Common::String &stopName);
84  void onPDAClose();
85 
86  bool isInteractingWith(const Actor *actor) const;
87 
88  void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage);
89 
90  State getState() const { return _state; }
91 
92  AudioInfoMgr *getAudioInfoMgr() { return &_audioInfoMgr; }
93 
94  Actor *getActorByPoint(Common::Point point);
95 
96  Actor *findActor(const Common::String &name);
97 
98 protected:
99  void forceUpdateCursor();
100 
101  virtual void updateCursor(Common::Point point);
102 
103  virtual void sendUseClickMessage(Actor *actor);
104  void sendLeftClickMessage(Actor *actor);
105 
106  virtual WalkLocation *getWalkDestination();
107 
108  void startInventory(bool paused);
109  bool startWalk();
110 
111  void cancelInteraction();
112 
113  Actor *_recipient;
114 
115  CursorMgr *_cursorMgr;
116  WalkMgr *_walkMgr;
117  Sequencer *_sequencer;
118 
119  AudioInfoMgr _audioInfoMgr;
120 
121  State _state;
122  State _nextState;
123  State _stateBeforeInventory;
124  State _stateBeforePDA;
125 
126  bool _isHaveItem;
127 };
128 
129 
130 class ParlSqPink : public LeadActor {
131 public:
132  void toConsole() const override;
133 
134 protected:
135  WalkLocation *getWalkDestination() override;
136 };
137 
138 class PubPink : public LeadActor {
139 public:
140  void toConsole() const override;
141 
142  void onRightButtonClick(Common::Point point) override;
143 
144  void onLeftClickMessage() override;
145  void onVariableSet() override;
146 
147 protected:
148  void updateCursor(Common::Point point) override;
149 
150  void sendUseClickMessage(Actor *actor) override;
151 
152  WalkLocation *getWalkDestination() override;
153 
154 private:
155  bool playingMiniGame();
156 };
157 
158 
159 } // End of namespace Pink
160 
161 #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
Definition: archive.h:35
Definition: lead_actor.h:41
Definition: lead_actor.h:130
Definition: rect.h:45
Definition: actor.h:39
Definition: walk_mgr.h:42
Definition: lead_actor.h:138