ScummVM API documentation
creature_logic.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 ULTIMA3_LOGIC_CREATURE_LOGIC_H
23#define ULTIMA3_LOGIC_CREATURE_LOGIC_H
24
25#include "common/array.h"
26#include "ultima/ultima3/data/map.h"
27
28namespace Ultima {
29namespace Ultima3 {
30
36public:
41 struct Breath {
42 int _x, _y;
43 int _dx, _dy;
44 };
45
46private:
47 Common::Array<Breath> _breaths;
48
49 // Alternates when travelling by horse or ship, so that creatures only
50 // get to move on every other step
51 int _stepToggle = 1;
52
57 int stepToward(int from, int to) const;
58
62 void stepTowardParty(int index, int &x, int &y) const;
63
67 bool canMoveTo(int index, int x, int y) const;
68
72 void moveTo(int index, int x, int y);
73
77 void spawnMonster();
78
82 void breathAttack(int index);
83
84public:
88 int creatureAt(int x, int y) const;
89
97 int update(bool moved);
98
103 Common::Array<Breath> result = _breaths;
104 _breaths.clear();
105 return result;
106 }
107};
108
109} // namespace Ultima3
110} // namespace Ultima
111
112#endif
Definition: array.h:52
void clear()
Definition: array.h:321
Definition: creature_logic.h:35
Common::Array< Breath > takeBreaths()
Definition: creature_logic.h:102
int creatureAt(int x, int y) const
Definition: creature_logic.h:41