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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef PETKA_OBJECT_H 24 #define PETKA_OBJECT_H 25 26 #include "common/rect.h" 27 28 #include "petka/base.h" 29 30 namespace Common { 31 class INIFile; 32 class SeekableReadStream; 33 } 34 35 namespace Petka { 36 37 class QVisibleObject { 38 public: 39 QVisibleObject(); ~QVisibleObject()40 virtual ~QVisibleObject() {}; 41 draw()42 virtual void draw() {}; update(int time)43 virtual void update(int time) {}; updateZ()44 virtual void updateZ() {}; show(bool v)45 virtual void show(bool v) {}; setPos(Common::Point p,bool center)46 virtual void setPos(Common::Point p, bool center) {}; isInPoint(Common::Point p)47 virtual bool isInPoint(Common::Point p) { return false; } onMouseMove(Common::Point p)48 virtual void onMouseMove(Common::Point p) {} onClick(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 58 class QMessageObject : public QVisibleObject { 59 public: 60 QMessageObject(); 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 118