ScummVM API documentation
sensor.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// Based on Phantasma code by Thomas Harte (2013),
23// available at https://github.com/TomHarte/Phantasma/ (MIT)
24
25#ifndef FREESCAPE_SENSOR_H
26#define FREESCAPE_SENSOR_H
27
28#include "freescape/area.h"
29#include "freescape/objects/object.h"
30#include "freescape/language/instruction.h"
31
32namespace Freescape {
33
34class Sensor : public Object {
35public:
36 Sensor(
37 uint16 objectID_,
38 const Math::Vector3d &origin_,
39 const Math::Vector3d &rotation_,
40 byte color_,
41 byte firingInterval_,
42 uint16 firingRange_,
43 uint16 axis_,
44 uint8 flags_,
45 FCLInstructionVector condition_,
46 Common::String conditionSource_);
47
48 byte _firingInterval;
49 uint16 _firingRange;
50 uint16 _axis;
51 bool _isShooting;
52
53 Common::String _conditionSource;
54 FCLInstructionVector _condition;
55
56 virtual ~Sensor() { delete _colours; }
57 bool isDrawable() override { return true; }
58 bool isPlanar() override { return true; }
59 bool isShooting() { return _isShooting; }
60 void scale(int factor) override;
61 Object *duplicate() override;
62
63 ObjectType getType() override { return kSensorType; };
64 Math::Vector3d getRotation() { return _rotation; }
65 void shouldShoot(bool shooting) { _isShooting = shooting; }
66
67 void draw(Freescape::Renderer *gfx, float offset = 0.0) override;
68
69 bool playerDetected(const Math::Vector3d &position, Area *area);
70
71 private:
72 Common::Array<uint8> *_colours;
73};
74
75} // End of namespace Freescape
76
77#endif // FREESCAPE_SENSOR_H
Definition: str.h:59
Definition: area.h:41
Definition: object.h:56
Definition: gfx.h:63
Definition: sensor.h:34
Definition: area.h:36