ScummVM API documentation
actor_anim_process.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 WORLD_ACTORS_ACTORANIMPROCESS_H
23 #define WORLD_ACTORS_ACTORANIMPROCESS_H
24 
25 #include "ultima/ultima8/kernel/process.h"
26 #include "ultima/ultima8/misc/direction.h"
27 #include "ultima/ultima8/world/actors/animation.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class Actor;
33 class AnimAction;
34 struct AnimFrame;
35 class AnimationTracker;
36 class Item;
37 
38 class ActorAnimProcess : public Process {
39 public:
41  ActorAnimProcess(Actor *actor, Animation::Sequence action, Direction dir,
42  uint32 steps = 0);
43 
44  ENABLE_RUNTIME_CLASSTYPE()
45 
46  static const uint16 ACTOR_ANIM_PROC_TYPE = 0x00F0;
47 
48  void run() override;
49 
50  void terminate() override;
51 
52  Common::String dumpInfo() const override;
53 
54  Animation::Sequence getAction() const {
55  return _action;
56  }
57 
58  bool loadData(Common::ReadStream *rs, uint32 version);
59  void saveData(Common::WriteStream *ws) override;
60 
61 protected:
62  virtual bool init();
63 
65  void doSpecial();
66 
68  void doHitSpecial(Item *hit);
69 
71  void doFireWeaponCru(Actor *actor, const AnimFrame *frame);
72 
73  Animation::Sequence _action;
74  Direction _dir;
75  uint32 _steps;
76 
77  AnimationTracker *_tracker;
78  int _repeatCounter;
79  uint32 _currentStep;
80 
81  bool _firstFrame;
82 
83  bool _animAborted;
84 
85  bool _attackedSomething; // attacked and hit something with this animation
86 
89 };
90 
91 } // End of namespace Ultima8
92 } // End of namespace Ultima
93 
94 #endif
void terminate() override
terminate the process. This wakes up all processes waiting for it.
Definition: str.h:59
Definition: stream.h:77
Definition: process.h:34
Definition: item.h:42
Definition: actor_anim_process.h:38
void saveData(Common::WriteStream *ws) override
save Process data
Definition: detection.h:27
bool _interpolate
Interpolate position on repeated frames.
Definition: actor_anim_process.h:88
Definition: animation_tracker.h:36
void doFireWeaponCru(Actor *actor, const AnimFrame *frame)
Fire weapon.
Definition: actor.h:37
Definition: anim_action.h:33
Definition: stream.h:385
void doSpecial()
perform special action for an animation
void doHitSpecial(Item *hit)
perform special action when hitting an opponent
Common::String dumpInfo() const override
dump some info about this process to a string