ScummVM API documentation
behavior.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 NGI_BEHAVIOR_H
23 #define NGI_BEHAVIOR_H
24 
25 namespace NGI {
26 
27 struct BehaviorMove {
28  MessageQueue *_messageQueue;
29  int _delay;
30  uint32 _percent;
31  int _flags;
32 
33  BehaviorMove(GameVar *subvar, Scene *sc, int *delay);
34 };
35 
36 struct BehaviorAnim {
37  int _staticsId;
38  int _flags;
39  Common::Array<BehaviorMove> _behaviorMoves;
40 
41  BehaviorAnim();
42  BehaviorAnim(GameVar *var, Scene *sc, StaticANIObject *ani, int *minDelay);
43 };
44 
45 struct BehaviorInfo {
46  StaticANIObject *_ani;
47  int _staticsId;
48  int _counter;
49  int _counterMax;
50  int _flags;
51  int _subIndex;
52  int _animsCount;
53  Common::Array<BehaviorAnim> _behaviorAnims;
54 
55  BehaviorInfo() { clear(); }
56 
57  void clear();
58  void initAmbientBehavior(GameVar *var, Scene *sc);
59  void initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *ani);
60 };
61 
62 class BehaviorManager : public CObject {
63  Common::Array<BehaviorInfo> _behaviors;
64  Scene *_scene;
65  bool _isActive;
66 
67  public:
69  ~BehaviorManager() override;
70 
71  void clear();
72 
73  void initBehavior(Scene *scene, GameVar *var);
74 
75  void updateBehaviors();
76  void updateBehavior(BehaviorInfo &behaviorInfo, BehaviorAnim &entry);
77  void updateStaticAniBehavior(StaticANIObject &ani, int delay, const BehaviorAnim &beh);
78 
79  bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag);
80 
81  void setFlagByStaticAniObject(StaticANIObject *ani, int flag);
82 
83  BehaviorMove *getBehaviorMoveByMessageQueueDataId(StaticANIObject *ani, int id1, int id2);
84 };
85 
86 } // End of namespace NGI
87 
88 #endif /* NGI_BEHAVIOR_H */
Definition: array.h:52
Definition: behavior.h:27
Definition: behavior.h:45
Definition: behavior.h:36
Definition: behavior.h:62
Definition: messages.h:108
Definition: objects.h:76
Definition: statics.h:172
Definition: scene.h:32
Definition: anihandler.h:25
Definition: utils.h:106