ScummVM API documentation
fightanim.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 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_FIGHTANIM_H
32 #define CRAB_FIGHTANIM_H
33 
34 #include "crab/ai/moveeffect.h"
35 #include "crab/animation/fm_ai_data.h"
36 #include "crab/input/fightinput.h"
37 #include "crab/event/triggerset.h"
38 
39 namespace Crab {
40 
41 namespace pyrodactyl {
42 namespace anim {
43 // A single frame of a fighting move
44 struct FightAnimFrame : public AnimFrame {
45  // The hit box of the player WITH RESPECT TO the sprite bounding box
46  //boxV is the vulnerable hit box, boxD is the damage hit box
47  Rect _boxD;
48 
49  // The displacement in the position caused by the frame
50  Vector2i _delta;
51 
52  // The sprite state for the duration of the frame
53  uint _state;
54 
55  // Can we cancel/branch to another move from this frame?
56  bool _branch;
57 
58  FightAnimFrame() {
59  _state = 0;
60  _branch = false;
61  }
62 
63  void load(rapidxml::xml_node<char> *node, const Rect &VBOX,
64  const uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
65 };
66 
67 // All data related to a single fighting move in a single direction
69  // The global vulnerable hit box for all the frames
70  // If the W or H of this is 0, then use individual frame values
71  Rect _boxV;
72 
73 public:
74  // The individual frames for each direction
76 
77  // The currentClip
78  uint _currentClip;
79 
80  // Should we flip the images in the frame rectangle?
81  TextureFlipType _flip;
82 
83  // The amount of time in milliseconds each animation frame needs to be on screen
84  // If this is zero then use the value in each individual frame
85  uint32 _repeat;
86 
87  // The global anchor value for all the frames
88  // If this is 0, then use individual frame values
89  Vector2i _anchor;
90 
91  // Does this set of animation frames need a specific shadow offset?
92  ShadowOffset _shadow;
93 
94  FightAnimFrames() {
95  reset();
96  _flip = FLIP_NONE;
97  _repeat = 0;
98  }
99  void reset() {
100  _currentClip = 0;
101  }
102 
103  void load(rapidxml::xml_node<char> *node);
104 };
105 } // End of namespace anim
106 } // End of namespace pyrodactyl
107 
108 } // End of namespace Crab
109 
110 #endif // CRAB_FIGHTANIM_H
Definition: Rectangle.h:42
Definition: array.h:52
Definition: fightanim.h:68
Definition: fightanim.h:44
Definition: moveeffect.h:37
Definition: animframe.h:42