1 /*************************************************************************** 2 * Free Heroes of Might and Magic II: https://github.com/ihhub/fheroes2 * 3 * Copyright (C) 2020 * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU General Public License as published by * 7 * the Free Software Foundation; either version 2 of the License, or * 8 * (at your option) any later version. * 9 * * 10 * This program is distributed in the hope that it will be useful, * 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * GNU General Public License for more details. * 14 * * 15 * You should have received a copy of the GNU General Public License * 16 * along with this program; if not, write to the * 17 * Free Software Foundation, Inc., * 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19 ***************************************************************************/ 20 21 #ifndef H2BIN_FRM_H 22 #define H2BIN_FRM_H 23 24 #include <cstddef> 25 #include <vector> 26 27 #include "math_base.h" 28 29 namespace Bin_Info 30 { 31 struct MonsterAnimInfo 32 { 33 enum ANIM_TYPE 34 { 35 MOVE_START, // Start of the moving sequence on 1st animation cycle: flyers will fly up 36 MOVE_TILE_START, // Supposed to be played at the beginning of 2nd+ move. 37 MOVE_MAIN, // Core animation. Most units only have this one. 38 MOVE_TILE_END, // Cavalry & wolf. Played at the end of the cycle (2nd tile to 3rd), but not at the last one 39 MOVE_STOP, // End of the moving sequence when arrived: landing for example 40 MOVE_ONE, // Used when moving 1 tile. LICH and POWER_LICH doesn't have this, use MOVE_MAIN 41 TEMPORARY, // This is an empty placeholder for combined animation built from previous parts 42 STATIC, // Frame 1 43 IDLE1, 44 IDLE2, // Idle animations: picked at random with different probablities, rarely all 5 present 45 IDLE3, 46 IDLE4, 47 IDLE5, 48 DEATH, 49 WINCE_UP, 50 WINCE_END, 51 ATTACK1, // Attacks, number represents the angle: 1 is TOP, 2 is CENTER, 3 is BOTTOM 52 ATTACK1_END, 53 DOUBLEHEX1, 54 DOUBLEHEX1_END, 55 ATTACK2, 56 ATTACK2_END, 57 DOUBLEHEX2, 58 DOUBLEHEX2_END, 59 ATTACK3, 60 ATTACK3_END, 61 DOUBLEHEX3, 62 DOUBLEHEX3_END, 63 SHOOT1, 64 SHOOT1_END, 65 SHOOT2, 66 SHOOT2_END, 67 SHOOT3, 68 SHOOT3_END 69 }; 70 71 std::vector<std::vector<int> > frameXOffset; 72 uint32_t moveSpeed; 73 uint32_t shootSpeed; 74 uint32_t flightSpeed; 75 fheroes2::Point eyePosition; 76 int32_t troopCountOffsetLeft; 77 int32_t troopCountOffsetRight; 78 std::vector<fheroes2::Point> projectileOffset; 79 std::vector<float> projectileAngles; 80 std::vector<float> idlePriority; 81 std::vector<uint32_t> unusedIdleDelays; 82 uint32_t idleAnimationCount; 83 uint32_t idleAnimationDelay; 84 std::vector<std::vector<int> > animationFrames; 85 86 MonsterAnimInfo( int monsterID = 0, const std::vector<uint8_t> & bytes = std::vector<uint8_t>() ); 87 bool hasAnim( int animID = MonsterAnimInfo::STATIC ) const; 88 bool isValid() const; 89 size_t getProjectileID( const double angle ) const; 90 }; 91 92 void InitBinInfo(); 93 MonsterAnimInfo GetMonsterInfo( uint32_t monsterID ); 94 } 95 #endif 96