ScummVM API documentation
object.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 PETKA_OBJECT_H
23 #define PETKA_OBJECT_H
24 
25 #include "common/rect.h"
26 #include "common/str.h"
27 
28 #include "petka/base.h"
29 
30 namespace Common {
31 class INIFile;
32 class SeekableReadStream;
33 }
34 
35 namespace Petka {
36 
38 public:
40  virtual ~QVisibleObject() {};
41 
42  virtual void draw() {};
43  virtual void update(int time) {};
44  virtual void updateZ() {};
45  virtual void show(bool v) {};
46  virtual void setPos(Common::Point p, bool center) {};
47  virtual bool isInPoint(Common::Point p) { return false; }
48  virtual void onMouseMove(Common::Point p) {}
49  virtual void onClick(Common::Point p) {}
50 
51 public:
52  int32 _resourceId;
53  int32 _z;
54 };
55 
56 class Sound;
57 
59 public:
61 
62  void show(bool v) override;
63  void setReaction(int16 id, QReaction *reaction);
64  virtual void processMessage(const QMessage &msg);
65  void processReaction(QReaction *reaction, const QMessage *msg = nullptr);
66 
67  virtual void play(int id, int type);
68 
69  void loadSound();
70  void removeSound();
71 
72  void readScriptData(Common::SeekableReadStream &stream);
73  virtual void readInisData(Common::INIFile &names, Common::INIFile &cast, Common::INIFile *bgs);
74 
75 public:
76  int32 _x;
77  int32 _y;
78  int32 _walkX;
79  int32 _walkY;
80  int32 _time;
81  byte _frame;
82  bool _isShown;
83  bool _animate;
84  bool _updateZ;
85  bool _holdMessages;
86  bool _isActive;
87  bool _startSound;
88  bool _loopedSound;
89  Sound *_sound;
90  int8 _status;
91  uint16 _id;
92  Common::String _name;
93  Common::String _nameOnScreen;
94  int32 _dialogColor;
95  Common::Array<QReaction> _reactions;
96  QReaction *_reaction;
97  int16 _reactionId;
98 };
99 
100 
101 class QObject : public QMessageObject {
102 public:
103  QObject();
104 
105  void draw() override;
106  void update(int time) override;
107  void updateZ() override;
108  bool isInPoint(Common::Point p) override;
109  void setPos(Common::Point p, bool center) override;
110  void show(bool v) override;
111  void onClick(Common::Point p) override;
112  void onMouseMove(Common::Point p) override;
113 };
114 
115 } // End of namespace Petka
116 
117 #endif
Definition: str.h:59
Definition: base.h:123
Definition: object.h:101
Definition: array.h:52
Definition: stream.h:745
Definition: base.h:98
Definition: algorithm.h:29
Definition: object.h:58
Definition: sound.h:36
Definition: object.h:37
Definition: rect.h:45
Definition: ini-file.h:58
Definition: base.h:27