HBhvSensor.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef _H_HBhvSensor_H
11 #define _H_HBhvSensor_H
12 
13 #ifdef H_PACK_8
14 #pragma pack(push)
15 #pragma pack(8)
16 #endif
17 
18 #include "HTools.h"
19 #include "HEventListener.h"
20 
22 class HBhvCondition;
23 class HBhvAction;
24 class HBhvTargetObject;
25 
26 
27 
29 
33 class MVO_API HBhvSensor
34 {
35 public:
36 
43  HBhvSensor(const char *name, bool active, HBhvBehaviorManager *BehaviorManager);
44  virtual ~HBhvSensor();
45 
50  void AddCondition(HBhvCondition *condition);
51 
55  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
56 
60  void Serialize(HUtilityXMLGenerator *xmlgen);
61 
63  HBhvBehaviorManager * GetBehaviorManager() { return m_pBehaviorManager; }
64 
70  void Activate(int delay = 0);
71 
75  void DeActivate();
76 
78  bool GetDefaultActive() { return m_bDefaultActive; }
79 
81  bool GetCurrentlyActive() { return m_bCurrentlyActive; }
82 
87  bool Evaluate();
88 
93  void AddAction(HBhvAction *action);
94 
96  const char * GetName() { return m_Name; }
97 
101  void Tick();
102 
103 
104 protected:
105  char m_Name[256];
108  struct vlist_s* m_ConditionList;
109  struct vlist_s* m_ActionList;
114  int m_Delay;
115 };
116 
117 
119 class MVO_API HBhvCondition
120 {
121 public:
122 
131  HBhvCondition(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
132  virtual ~HBhvCondition();
133 
138  virtual void SetTarget(const char *target);
139 
141  virtual HBhvSensor * GetSensor() { return m_pSensor; }
142 
146  virtual void Register() { }
147 
151  virtual void UnRegister() { }
152 
158  virtual void Evaluate(bool &and_flag, bool &or_flag);
159 
163  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
164 
168  virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt);
169 
173  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
174 
175  protected:
176  char m_Event[256];
180  bool m_bInvert;
181  char m_Value[256];
183 };
184 
185 
188 {
189 public:
198  HBhvConditionAnimationRunning(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
199 
206  virtual void Evaluate(bool &and_flag, bool &or_flag);
207 
211  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
212 
213 };
214 
217 {
218 public:
219 
228  HBhvConditionSensorActive(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
229 
236  virtual void Evaluate(bool &and_flag, bool &or_flag);
237 
241  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
242 
243 protected:
244 };
245 
246 
247 
249 class MVO_API HBhvConditionMouse : public HBhvCondition, public HMouseListener
250 {
251 public:
252 
261  HBhvConditionMouse(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
262 
266  virtual void Register();
267 
271  virtual void UnRegister();
272 
273 
281  bool IsClicked(HC_KEY target, float x, float y);
282 
283 
284 };
285 
287 class MVO_API HBhvConditionAnimation : public HBhvCondition, public HAnimationListener
288 {
289 public:
290 
299  HBhvConditionAnimation(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
300 
304  virtual void Register();
305 
309  virtual void UnRegister();
310 protected:
311 };
312 
314 class MVO_API HBhvConditionSensor : public HBhvCondition, public HSensorListener
315 {
316 public:
317 
326  HBhvConditionSensor(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
327 
331  virtual void Register();
332 
336  virtual void UnRegister();
337 };
338 
339 
342 {
343 public:
344 
353  HBhvConditionSensorActivated(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
354 
359  virtual int SensorActivatedEvent(HBhvSensor * ainst);
360 
364  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
365 
366 };
367 
368 
369 
372 {
373 public:
382  HBhvConditionSensorAction(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
383 
388  virtual int SensorActionEvent(const char * action);
389 
393  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
394 
395 };
396 
399 {
400 public:
409  HBhvConditionAnimationFinished(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
410 
415  virtual int AnimationFinishedEvent(HBhvAnimation * animation);
416 
420  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
421 
422 
423 };
424 
425 
426 
429 {
430 public:
431 
440  HBhvConditionONLCLICK(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
441 
449  virtual int OnLButtonDown(HEventInfo &hevent);
450 
454  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
455 
456 protected:
457 };
458 
459 
460 
463 {
464 public:
465 
474  HBhvConditionONMOUSEENTER(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
475 
481  virtual int OnMouseMove(HEventInfo &hevent);
482 
486  void UnRegister();
487 
491  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
492 
493 protected:
494  HC_KEY m_OldKey;
495 };
496 
499 {
500 public:
501 
510  HBhvConditionONMOUSELEAVE(const char *target, const char *hevent, bool invert, HBhvSensor *sensor);
511 
517  virtual int OnMouseMove(HEventInfo &hevent);
518 
522  void UnRegister();
523 
527  virtual void Serialize(HUtilityXMLGenerator *xmlgen);
528 
529 protected:
530  HC_KEY m_OldKey;
531 };
532 
533 
534 
536 
572 class MVO_API HBhvAction
573 {
574 public:
575 
583  HBhvAction(const char *target, const char *type, const char *value, HBhvSensor *sensor);
584 
588  virtual ~HBhvAction();
589 
590 
595  void SetTargetByPath(const char *targetpath);
596 
600  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
601 
602 
606  void DoAction();
607 
611  void Serialize(HUtilityXMLGenerator *xmlgen);
612 
613 protected:
614  char m_Type[256];
615  char m_Value[MVO_BUFFER_SIZE];
620 };
621 
622 
623 
624 
625 #ifdef H_PACK_8
626 #pragma pack(pop)
627 #endif
628 
629 #endif
The HBhvConditionSensorActivated class evaluates if a sensor has been activated.
Definition: HBhvSensor.h:341
int m_Delay
Definition: HBhvSensor.h:114
The HBhvConditionAnimationFinished class evaluates if an animation has finished executing.
Definition: HBhvSensor.h:398
The HBhvConditionONMOUSEENTER class evaluates if the mouse pointer has entered the bounding box of th...
Definition: HBhvSensor.h:462
The HBhvConditionMouse class is the base class for all mouse related conditions.
Definition: HBhvSensor.h:249
bool m_bDefaultActive
Definition: HBhvSensor.h:112
HBhvBehaviorManager * GetBehaviorManager()
Definition: HBhvSensor.h:63
The HBhvBehaviorManager class stores and manages all animation related data.
Definition: HBhvBehaviorManager.h:237
struct vlist_s * m_ActionList
Definition: HBhvSensor.h:109
virtual void UnRegister()
The HBhvCondition class is the base class for all condition types.
Definition: HBhvSensor.h:119
struct vlist_s * m_ConditionList
Definition: HBhvSensor.h:108
HC_KEY m_OldKey
Definition: HBhvSensor.h:494
HC_KEY m_OldKey
Definition: HBhvSensor.h:530
The HBhvConditionSensorAction class evaluates if the target sensor has performed an action...
Definition: HBhvSensor.h:371
bool m_bInvert
Definition: HBhvSensor.h:180
The HBhvConditionSensor class is the base class for sensor related conditions.
Definition: HBhvSensor.h:314
virtual HBhvSensor * GetSensor()
Definition: HBhvSensor.h:141
const char * GetName()
Definition: HBhvSensor.h:96
The HBhvTargetObject class encapsulates various target types for animations and sensors.
Definition: HBhvBehaviorManager.h:82
The HBhvSensor class encapsulates an animation sensor.
Definition: HBhvSensor.h:33
virtual void UnRegister()
Definition: HBhvSensor.h:151
The HBhvConditionONLCLICK class evaluates if the given target was selected when the left mouse button...
Definition: HBhvSensor.h:428
virtual void Evaluate(bool &and_flag, bool &or_flag)
HBhvTargetObject * m_pTarget
Definition: HBhvSensor.h:177
HBhvSensor * m_pSensor
Definition: HBhvSensor.h:616
The HBhvAnimation class defines an animation.
Definition: HBhvAnimation.h:43
HBhvSensor * m_pSensor
Definition: HBhvSensor.h:179
The HBhvConditionONMOUSEENTER class evaluates if the mouse pointer has left the bounding box of the t...
Definition: HBhvSensor.h:498
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:207
virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt)
The HBhvConditionAnimationRunning class evaluates if an animation is currently running for a given ta...
Definition: HBhvSensor.h:187
bool GetCurrentlyActive()
Definition: HBhvSensor.h:81
HBhvBehaviorManager * m_pBehaviorManager
Definition: HBhvSensor.h:106
bool m_bConditionMet
Definition: HBhvSensor.h:178
The HBhvAction class encapsulates an animation action.
Definition: HBhvSensor.h:572
virtual void Register()
Definition: HBhvSensor.h:146
The HBhvConditionSensorActive class evaluates if the given sensor is currently active.
Definition: HBhvSensor.h:216
bool GetDefaultActive()
Definition: HBhvSensor.h:78
The HBhvConditionAnimation class is the base class for all animation related conditions.
Definition: HBhvSensor.h:287
bool m_bCurrentlyActive
Definition: HBhvSensor.h:111
HBhvTargetObject * m_pTarget
Definition: HBhvSensor.h:617