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_WINDOW_BATTLESTATUS_H
19 #define EP_WINDOW_BATTLESTATUS_H
20 
21 // Headers
22 #include "window_selectable.h"
23 #include "bitmap.h"
24 
25 /**
26  * Window BattleStatus Class.
27  * Displays the party battle status.
28  */
29 class Window_BattleStatus : public Window_Selectable {
30 public:
31 	enum ChoiceMode {
32 		/** Allow selection of any actor */
33 		ChoiceMode_All,
34 		/** Allow selection of alive actors */
35 		ChoiceMode_Alive,
36 		/** Allow selection of dead actors */
37 		ChoiceMode_Dead,
38 		/** Allow selection of ready (gauge full) actors (RPG2k3 only) */
39 		ChoiceMode_Ready,
40 		/** Don't allow changing the current selection (if any) */
41 		ChoiceMode_None
42 	};
43 
44 	/**
45 	 * Constructor.
46 	 */
47 	Window_BattleStatus(int ix, int iy, int iwidth, int iheight, bool enemy = false);
48 
49 	/**
50 	 * Renders the current status on the window.
51 	 */
52 	void Refresh();
53 
54 	/**
55 	 * Updates the window state.
56 	 */
57 	void Update() override;
58 
59 	/**
60 	 * Selects an active character if one is ready.
61 	 */
62 	int ChooseActiveCharacter();
63 
64 	/**
65 	 * Defines which characters can be selected in the dialog.
66 	 *
67 	 * @param new_mode new selection mode
68 	 */
69 	void SetChoiceMode(ChoiceMode new_mode);
70 
71 	void RefreshActiveFromValid();
72 
73 protected:
74 	/**
75 	 * Updates the cursor rectangle.
76 	 */
77 	void UpdateCursorRect() override;
78 
79 	/**
80 	 * Redraws the characters time gauge.
81 	 */
82 	void RefreshGauge();
83 
84 	void DrawGaugeSystem2(int x, int y, int cur_value, int max_value, int which);
85 	void DrawNumberSystem2(int x, int y, int value);
86 
87 	/**
88 	 * Tests whether actor is selectable in current ChoiceMode.
89 	 *
90 	 * @return true: selection possible
91 	 */
92 	bool IsChoiceValid(const Game_Battler& battler) const;
93 
94 	ChoiceMode mode;
95 
96 	// Debug helper
97 	bool enemy;
98 
99 	FileRequestBinding request_id;
100 
101 	int actor_face_height = 24;
102 };
103 
104 #endif
105