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 CINE_ANIM_H 24 #define CINE_ANIM_H 25 26 #include "common/endian.h" 27 28 #include "cine/saveload.h" 29 30 namespace Cine { 31 32 struct AnimHeaderStruct { 33 byte field_0; 34 byte field_1; 35 byte field_2; 36 byte field_3; 37 uint16 frameWidth; 38 uint16 frameHeight; 39 byte field_8; 40 byte field_9; 41 byte field_A; 42 byte field_B; 43 byte field_C; 44 byte field_D; 45 uint16 numFrames; 46 byte field_10; 47 byte field_11; 48 byte field_12; 49 byte field_13; 50 uint16 field_14; 51 }; 52 53 struct AnimDataEntry { 54 char name[9]; 55 byte color; 56 }; 57 58 #define ANIM_RAW 0 // memcpy 59 #define ANIM_MASK 1 // convertMask 60 #define ANIM_SPRITE 2 // gfxConvertSpriteToRaw 61 #define ANIM_MASKSPRITE 3 // gfxConvertSpriteToRaw + generateMask 62 #define ANIM_PALSPRITE 5 // convert8BBP 63 #define ANIM_FULLSPRITE 8 // convert8BBP2 64 65 class AnimData { 66 private: 67 byte *_data; ///< Image data 68 byte *_mask; ///< Image mask (may be NULL) 69 int16 _fileIdx; ///< Source file index in bundle 70 int16 _frameIdx; ///< Frame number in animation 71 char _name[10]; ///< Part filename 72 int _size; ///< _data/_mask size, internal only 73 74 public: 75 uint16 _width; ///< Image width (usually twice the real size) 76 uint16 _height; ///< Image height 77 uint16 _bpp; ///< Bit depth/type information 78 uint16 _var1; ///< Something related to width 79 int _realWidth; ///< Real image width in bytes 80 81 AnimData(); 82 AnimData(const AnimData &src); 83 ~AnimData(); 84 85 AnimData &operator=(const AnimData &src); 86 data()87 const byte *data() const { return _data; } ///< Image data mask()88 const byte *mask() const { return _mask; } ///< Image mask (may be NULL) 89 byte getColor(int x, int y); 90 91 void load(byte *d, int type, uint16 w, uint16 h, int16 file, int16 frame, const char *n, byte transparent = 0); 92 void clear(); 93 94 void save(Common::OutSaveFile &fHandle) const; 95 }; 96 97 #define NUM_MAX_ANIMDATA 255 98 99 void freeAnimDataTable(); 100 void freeAnimDataRange(byte startIdx, byte numIdx); 101 int loadResource(const char *resourceName, int16 idx = -1, int16 frameIndex = -1); 102 void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat); 103 void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency); 104 105 } // End of namespace Cine 106 107 #endif 108