ScummVM API documentation
hotspot.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, MojoTouch has
23  * exclusively licensed this code on March 23th, 2024, to be used in
24  * closed-source products.
25  * Therefore, any contributions (commits) to it will also be dual-licensed.
26  *
27  */
28 
29 #ifndef TOON_HOTSPOT_H
30 #define TOON_HOTSPOT_H
31 
32 #include "toon/toon.h"
33 #include "toon/tools.h"
34 
35 namespace Toon {
36 
37 class HotspotData {
38 public:
39  int16 getX1() const { return READ_LE_INT16(_data + 0); }
40  int16 getY1() const { return READ_LE_INT16(_data + 1); }
41  int16 getX2() const { return READ_LE_INT16(_data + 2); }
42  int16 getY2() const { return READ_LE_INT16(_data + 3); }
43  int16 getMode() const { return READ_LE_INT16(_data + 4); }
44  int16 getRef() const { return READ_LE_INT16(_data + 5); }
45  int16 getPriority() const { return READ_LE_INT16(_data + 7); }
46  int16 getType() const { return READ_LE_INT16(_data + 8); }
47  int16 getData(int32 id) const { return READ_LE_INT16(_data + id); }
48  void setData(int32 id, int16 val) { WRITE_LE_UINT16(&_data[id], val); }
49 
50 private:
51  int16 _data[256];
52 };
53 
54 class Hotspots {
55 public:
56  Hotspots(ToonEngine *vm);
57  ~Hotspots();
58 
59  bool loadRif(const Common::Path &rifName, const Common::Path &additionalRifName);
60  int32 find(int16 x, int16 y);
61  int32 findBasedOnCorner(int16 x, int16 y);
62  HotspotData *get(int32 id);
63  int32 getCount() const { return _numItems; }
64 
65  void load(Common::ReadStream *Stream);
66  void save(Common::WriteStream *Stream);
67 
68 protected:
69  HotspotData *_items;
70  int32 _numItems;
71  ToonEngine *_vm;
72 };
73 
74 } // End of namespace Toon
75 
76 #endif
Definition: hotspot.h:37
Definition: stream.h:77
In find(In first, In last, const T &v)
Definition: algorithm.h:225
Definition: path.h:52
Definition: toon.h:118
Definition: stream.h:385
Definition: anim.h:39
Definition: hotspot.h:54