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 ULTIMA8_WORLD_SPRITEPROCESS_H 24 #define ULTIMA8_WORLD_SPRITEPROCESS_H 25 26 #include "ultima/ultima8/kernel/process.h" 27 #include "ultima/ultima8/usecode/intrinsics.h" 28 29 namespace Ultima { 30 namespace Ultima8 { 31 32 //! Creates a Sprite. Animates it. Destroys it. 33 class SpriteProcess : public Process { 34 int _shape; 35 int _frame; 36 int _firstFrame; 37 int _lastFrame; 38 int _repeats; 39 int _delay; 40 int _x, _y, _z; 41 int _delayCounter; 42 bool _initialized; 43 public: 44 // p_dynamic_class stuff 45 ENABLE_RUNTIME_CLASSTYPE() 46 47 SpriteProcess(); 48 49 //! SpriteProcess Constructor 50 //! \param shape The shape to use 51 //! \param frame The initial/first frame of the sprite animation 52 //! \param last_frame The last frame of the sprite animation 53 //! \param repeats The number of times to play the sprite animation 54 //! \param delay The number of runs to wait before incrementing the frame 55 //! \param x X coord of the sprite in the world 56 //! \param y Y coord of the sprite in the world 57 //! \param z Z coord of the sprite in the world 58 //! \param delayed_init if true, wait with initialization until first run 59 SpriteProcess(int shape, int frame, int last_frame, 60 int repeats, int delay, int x, int y, int z, 61 bool delayed_init = false); 62 63 //! The SpriteProcess destructor 64 ~SpriteProcess(void) override; 65 66 //! Move the sprite to a new location 67 void move(int x, int y, int z); 68 69 //! The SpriteProcess run function 70 void run() override; 71 72 INTRINSIC(I_createSprite); 73 74 protected: 75 void init(); 76 77 public: 78 bool loadData(Common::ReadStream *rs, uint32 version); 79 void saveData(Common::WriteStream *ws) override; 80 }; 81 82 } // End of namespace Ultima8 83 } // End of namespace Ultima 84 85 #endif 86