ScummVM API documentation
fightinput.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_FIGHTINPUT_H
32 #define CRAB_FIGHTINPUT_H
33 
34 #include "crab/input/input.h"
35 #include "crab/rapidxml/rapidxml.hpp"
36 
37 namespace Crab {
38 
39 namespace pyrodactyl {
40 namespace input {
41 // The animations a sprite can play
42 enum FightAnimationType {
43  // Idle state, you can launch new moves from this state only
44  // You return to this state once a move animation is done
45  FA_IDLE,
46 
47  // The moves a sprite can do
48  FA_ATTACK,
49  FA_BLOCK,
50 
51  // The hurt animation
52  FA_HURT,
53 
54  // The death animation
55  FA_DEAD
56 };
57 
58 // The input necessary to launch a move
59 struct FightInput {
60  // The state needed to execute this move
61  FightAnimationType _type;
62 
63  // The sprite state, used to have different moves trigger from the same move
64  uint _state;
65 
66  FightInput() {
67  reset();
68  }
69 
70  void reset() {
71  _type = FA_IDLE;
72  _state = 0;
73  }
74 
75  bool operator==(const FightInput &input) {
76  return _type == input._type && _state == input._state;
77  }
78 
79  bool idle() {
80  return _type == FA_IDLE;
81  }
82 
83  void load(rapidxml::xml_node<char> *node);
84 
85  FightAnimationType handleEvents(const Common::Event &event);
86 };
87 } // End of namespace input
88 } // End of namespace pyrodactyl
89 
90 } // End of namespace Crab
91 
92 #endif // CRAB_FIGHTINPUT_H
Definition: fightinput.h:59
Definition: events.h:199
Definition: moveeffect.h:37