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_BATTLER_H
19 #define EP_SPRITE_BATTLER_H
20 
21 // Headers
22 #include "sprite.h"
23 #include "async_handler.h"
24 
25 class BattleAnimation;
26 class Game_Battler;
27 
28 /**
29  * Sprite_Battler class, used for battle sprites
30  */
31 class Sprite_Battler : public Sprite {
32 public:
33 	/**
34 	 * Constructor.
35 	 *
36 	 * @param battler game battler to display
37 	 * @param battle_index battle index for Z ordering
38 	 */
39 	Sprite_Battler(Game_Battler* battler, int battle_index);
40 
41 	~Sprite_Battler() override;
42 
43 	Game_Battler* GetBattler() const;
44 
45 	void SetBattler(Game_Battler* new_battler);
46 
47 	/**
48 	 * Recompute the Z value for the sprite from it's Y coordinate.
49 	 */
50 	virtual void ResetZ();
51 
52 protected:
53 	Game_Battler* battler = nullptr;
54 	int battle_index = 0;
55 };
56 
GetBattler()57 inline Game_Battler* Sprite_Battler::GetBattler() const {
58 	return battler;
59 }
60 
SetBattler(Game_Battler * new_battler)61 inline void Sprite_Battler::SetBattler(Game_Battler* new_battler) {
62 	battler = new_battler;
63 }
64 
65 
66 #endif
67