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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef WORLD_ACTORS_ACTORANIMPROCESS_H 24 #define WORLD_ACTORS_ACTORANIMPROCESS_H 25 26 #include "ultima/ultima8/kernel/process.h" 27 #include "ultima/ultima8/misc/direction.h" 28 #include "ultima/ultima8/world/actors/animation.h" 29 30 namespace Ultima { 31 namespace Ultima8 { 32 33 class Actor; 34 class AnimAction; 35 struct AnimFrame; 36 class AnimationTracker; 37 class Item; 38 39 class ActorAnimProcess : public Process { 40 public: 41 ActorAnimProcess(); 42 ActorAnimProcess(Actor *actor, Animation::Sequence action, Direction dir, 43 uint32 steps = 0); 44 45 ENABLE_RUNTIME_CLASSTYPE() 46 47 static const uint16 ACTOR_ANIM_PROC_TYPE = 0x00F0; 48 49 void run() override; 50 51 void terminate() override; 52 53 void dumpInfo() const override; 54 getAction()55 Animation::Sequence getAction() const { 56 return _action; 57 } 58 59 bool loadData(Common::ReadStream *rs, uint32 version); 60 void saveData(Common::WriteStream *ws) override; 61 62 protected: 63 virtual bool init(); 64 65 //! perform special action for an animation 66 void doSpecial(); 67 68 //! perform special action when hitting an opponent 69 void doHitSpecial(Item *hit); 70 71 //! Fire weapon 72 void doFireWeaponCru(Actor *actor, const AnimFrame *frame); 73 74 Animation::Sequence _action; 75 Direction _dir; 76 uint32 _steps; 77 78 AnimationTracker *_tracker; 79 int _repeatCounter; 80 uint32 _currentStep; 81 82 bool _firstFrame; 83 84 bool _animAborted; 85 86 bool _attackedSomething; // attacked and hit something with this animation 87 88 //! Interpolate position on repeated frames 89 bool _interpolate; 90 }; 91 92 } // End of namespace Ultima8 93 } // End of namespace Ultima 94 95 #endif 96