ScummVM API documentation
egg.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#ifndef ULTIMA8_WORLD_EGG_H
22#define ULTIMA8_WORLD_EGG_H
23
24#include "ultima/ultima8/world/item.h"
25#include "ultima/ultima8/usecode/intrinsics.h"
26
27namespace Ultima {
28namespace Ultima8 {
29
30class Egg : public Item {
31 friend class ItemFactory;
32public:
33 Egg();
34 ~Egg() override;
35
36 ENABLE_RUNTIME_CLASSTYPE()
37
38 int getXRange() const {
39 return (_npcNum >> 4) & 0xF;
40 }
41 int getYRange() const {
42 return _npcNum & 0xF;
43 }
44
45 void setXRange(int r) {
46 _npcNum &= 0x0F;
47 _npcNum |= (r & 0xF) << 4;
48 }
49 void setYRange(int r) {
50 _npcNum &= 0xF0;
51 _npcNum |= (r & 0xF);
52 }
53
55 virtual uint16 hatch();
56
58 virtual uint16 unhatch();
59
61 void leaveFastArea() override;
62
64 void reset() {
65 _hatched = false;
66 }
67
68 Common::String dumpInfo() const override;
69
70 bool loadData(Common::ReadStream *rs, uint32 version);
71 void saveData(Common::WriteStream *ws) override;
72
73 INTRINSIC(I_getEggXRange);
74 INTRINSIC(I_getEggYRange);
75 INTRINSIC(I_setEggXRange);
76 INTRINSIC(I_setEggYRange);
77 INTRINSIC(I_getEggId);
78 INTRINSIC(I_setEggId);
79
80protected:
81 bool _hatched;
82};
83
84} // End of namespace Ultima8
85} // End of namespace Ultima
86
87#endif
Definition: stream.h:385
Definition: str.h:59
Definition: stream.h:77
Definition: egg.h:30
void leaveFastArea() override
The item has left the fast area.
Common::String dumpInfo() const override
dump some info about this object to a string
virtual uint16 unhatch()
unhatch the egg (for Crusader only)
virtual uint16 hatch()
hatch the egg
void reset()
clear the '_hatched' flag
Definition: egg.h:64
Definition: item_factory.h:34
Definition: item.h:42