1 /*
2  * This file is part of EasyRPG Player.
3  *
4  * EasyRPG Player is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * EasyRPG Player is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef EP_SPRITE_WEAPON_H
19 #define EP_SPRITE_WEAPON_H
20 
21 // Headers
22 #include "sprite_battler.h"
23 #include "async_handler.h"
24 
25 class Game_Actor;
26 
27 /**
28  * Sprite_Weapon class, used for weapon battle sprites
29  */
30 class Sprite_Weapon : public Sprite {
31 public:
32 	/**
33 	 * Constructor.
34 	 *
35 	 * @param actor game battler to display
36 	 */
37 	Sprite_Weapon(Game_Actor* actor);
38 
39 	~Sprite_Weapon() override;
40 
41 	/**
42 	 * Updates sprite state.
43 	 */
44 	void Update();
45 
46 	void SetWeaponAnimation(int nweapon_animation_id);
47 
48 	void SetRanged(bool nranged);
49 
50 	void StartAttack(bool secondary_weapon);
51 
52 	void StopAttack();
53 
54 	void Draw(Bitmap& dst) override;
55 
56 protected:
57 	void CreateSprite();
58 	void OnBattleWeaponReady(FileRequestResult* result, int32_t weapon_index);
59 
60 	Game_Actor* battler;
61 
62 	BitmapRef graphic;
63 	int weapon_animation_id = 0;
64 	bool ranged = false;
65 	bool attacking = false;
66 	int cycle = 0;
67 	int sprite_frame = -1;
68 
69 	FileRequestBinding request_id;
70 };
71 
72 
73 #endif
74