26 #ifndef SAGA2_SENSOR_H 27 #define SAGA2_SENSOR_H 31 const uint32 kNonActorSenseFlags = kActorSeeInvis;
34 const size_t kMaxSensorSize = 48;
38 const int16 kMaxSenseRange = 0;
43 kSpecificObjectSensor,
44 kObjectPropertySensor,
51 const int16 kSensorCheckRate = 5;
60 void newSensorList(SensorList *s);
62 void deleteSensorList(SensorList *p);
65 SensorList *fetchSensorList(GameObject *obj);
68 void newSensor(Sensor *s);
70 void newSensor(Sensor *s, int16 ctr);
72 void deleteSensor(Sensor *p);
77 void assertEvent(
const GameEvent &ev);
84 void cleanupSensors();
118 debugC(1, kDebugSensors,
"Adding SensorList %p to %d (%s) (total %d)",
119 (
void *)
this, o->thisID(), o->objName(), _list.
size());
123 deleteSensorList(
this);
124 debugC(1, kDebugSensors,
"Deleting SensorList %p of %d (%s) (total %d)",
125 (
void *)
this, _obj->thisID(), _obj->objName(), _list.
size());
132 static int32 archiveSize() {
133 return sizeof(ObjectID);
158 Sensor(
GameObject *o, SensorID sensorID, int16 rng) : _obj(o), _id(sensorID), _range(rng), _active(
true) {
161 debugC(1, kDebugSensors,
"Adding Sensor %p to %d (%s) (list = %p, total = %d)",
162 (
void *)
this, o->thisID(), o->objName(), (
void *)sl, (sl !=
nullptr) ? sl->_list.size() : -1);
171 debugC(1, kDebugSensors,
"Deleting Sensor %p of %d (%s) (list = %p, total = %d)",
172 (
void *)
this, _obj->thisID(), _obj->objName(), (
void *)sl, (sl !=
nullptr) ? sl->_list.size() : -1);
178 virtual int16 getType() = 0;
191 virtual bool check(
SenseInfo &info, uint32 senseFlags) = 0;
194 virtual bool evaluateEvent(
const GameEvent &event) = 0;
205 Sensor(o, sensorID, rng) {
209 debugC(3, kDebugSaveload,
"Loading ProtagonistSensor");
216 bool check(
SenseInfo &info, uint32 senseFlags);
219 bool evaluateEvent(
const GameEvent &event);
230 Sensor(o, sensorID, rng) {
236 bool check(
SenseInfo &info, uint32 senseFlags);
239 bool evaluateEvent(
const GameEvent &event);
243 virtual bool isObjectSought(
GameObject *obj) = 0;
251 ObjectID _soughtObjID;
259 ObjectID objToSense) :
261 _soughtObjID(objToSense) {
276 bool check(
SenseInfo &info, uint32 senseFlags);
288 ObjectPropertyID _objectProperty;
296 ObjectPropertyID propToSense) :
298 _objectProperty(propToSense) {
335 virtual bool isActorSought(
Actor *a) = 0;
351 Actor *actorToSense) :
353 _soughtActor(actorToSense) {
368 bool check(
SenseInfo &info, uint32 senseFlags);
372 bool isActorSought(
Actor *a);
380 ActorPropertyID _actorProperty;
388 ActorPropertyID propToSense) :
390 _actorProperty(propToSense) {
406 bool isActorSought(
Actor *a);
436 bool check(
SenseInfo &info, uint32 senseFlags);
439 bool evaluateEvent(
const GameEvent &event);
Definition: savefile.h:54
size_type size() const
Definition: list.h:198
Definition: memstream.h:194
Definition: objects.h:118
void void void void void debugC(int level, uint32 debugChannels, MSVC_PRINTF const char *s,...) GCC_PRINTF(3