ScummVM API documentation
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_ACTOR_H
23 #define PINK_ACTOR_H
24 
25 #include "common/rect.h"
26 
27 #include "pink/utils.h"
28 
29 namespace Pink {
30 
31 class Page;
32 class Action;
33 class Sequencer;
34 class Screen;
35 class CursorMgr;
36 class InventoryItem;
37 class InventoryMgr;
38 
39 class Actor : public NamedObject {
40 public:
41  Actor();
42  ~Actor() override;
43 
44  void deserialize(Archive &archive) override;
45 
46  void loadState(Archive &archive);
47  void saveState(Archive &archive);
48 
49  virtual void init(bool paused);
50  bool initPalette(Screen *screen);
51 
52  void toConsole() const override;
53 
54  bool isPlaying() const { return !_isActionEnded; }
55  virtual void pause(bool paused);
56 
57  void endAction() { _isActionEnded = true; }
58 
59  virtual bool isSupporting() const { return false; }
60  virtual bool isCursor() const { return false; }
61 
62  virtual bool isLeftClickHandlers() const { return false; }
63  virtual bool isUseClickHandlers(InventoryItem *item) const { return false; }
64 
65  virtual void onMouseOver(Common::Point point, CursorMgr *mgr);
66  virtual void onMouseOverWithItem(Common::Point point, const Common::String &itemName, CursorMgr *cursorMgr);
67 
68  virtual void onTimerMessage() {}
69  virtual void onLeftClickMessage() {}
70  virtual void onUseClickMessage(InventoryItem *item, InventoryMgr *mgr) {}
71 
72  Action *findAction(const Common::String &name);
73 
74  Action *getAction() { return _action; }
75  const Action *getAction() const { return _action; }
76  Page *getPage() { return _page; }
77  const Page *getPage() const { return _page; }
78 
79  InventoryMgr *getInventoryMgr() const;
80 
81  virtual Common::String getPDALink() const;
82 
83  virtual Common::String getLocation() const;
84 
85  void setAction(const Common::String &name) { setAction(findAction(name)); }
86  void setAction(Action *newAction);
87  void setAction(Action *newAction, bool loadingSave);
88 
89 protected:
90  Page *_page;
91 
92  Action *_action;
93  Array<Action *> _actions;
94 
95  bool _isActionEnded;
96 };
97 
98 } // End of namespace Pink
99 
100 #endif
Definition: archive.h:39
Definition: cursor_mgr.h:35
Definition: str.h:59
Definition: inventory.h:48
Definition: object.h:40
Definition: atari-screen.h:60
Definition: action.h:33
Definition: archive.h:35
Definition: screen.h:44
Definition: rect.h:45
Definition: actor.h:39
Definition: page.h:36
Definition: utils.h:30
Definition: inventory.h:31