/
CombatUnitWindow.h
207 lines (152 loc) · 4.87 KB
/
CombatUnitWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#ifndef COMBATUNITWINDOW_H
#define COMBATUNITWINDOW_H
#include "../ogui/IOguiButtonListener.h"
#include "../ogui/Ogui.h"
// some constants
#define COMBATUNITWINDOW_MAX_WEAPONS 2
#define COMBATUNITWINDOW_MAX_PARTS 6
#define COMBATUNITWINDOW_PART_HP_IMAGES 4
#define COMBATUNITWINDOW_PART_HP_IMGTYPES 6
#define COMBATUNITWINDOW_MAX_HPBLOCKS 10
#define COMBATUNITWINDOW_MAX_ENERGYBLOCKS 22
#define COMBATUNITWINDOW_HEAT_IMAGES 10
//#define COMBATUNITWINDOW_UNIT_HP_IMAGES 1
// none, red, blue, yellow groups.
#define COMBATUNITWINDOW_UNIT_GROUPS 4
namespace game
{
class Game;
class Unit;
}
namespace ui
{
/**
*
* Combat _UNIT_ window class.
* (one unit's stuff inside the combat window)
*
* @version 0.5, 23.6.2002
* @author Jukka Kokkonen <jukka@frozenbyte.com>
* @see CombatWindow
*
*/
class CombatUnitWindow : public IOguiButtonListener
{
public:
enum WEAPON_STATE
{
WEAPON_STATE_INACTIVE,
WEAPON_STATE_ACTIVE,
WEAPON_STATE_NOAMMO
};
CombatUnitWindow(Ogui *ogui, game::Game *game, game::Unit *unit, int unitNumber);
~CombatUnitWindow();
void CursorEvent(OguiButtonEvent *eve);
void hide();
void show();
bool isVisible();
/**
* Move the unit window to given screen coordinates.
* @param x int, x-coordinate of upper left corner
* @param y int, y-coordinate of upper left corner
*/
void moveTo(int x, int y);
/**
* Set's the unit selected or unselected.
* Does not affect gameplay, only visual side...?!
* @param selected bool, true if the unit is to be selected,
* false if the unit is to be unselected.
*/
void setUnitSelection(bool selected);
void setWeaponState(int weaponNumber, WEAPON_STATE state);
void setWeaponAmmoAmount(int weaponNumber, int ammoAmount);
void updateWeaponInfo();
void updateMiscInfo();
void updateSelectionInfo();
void updateHPInfo();
void updateEnergyInfo();
void updateModeInfo();
void doUnitSelection();
/**
* Returns the unit that this status window is bound to.
*/
game::Unit *getUnit();
private:
Ogui *ogui;
game::Game *game;
game::Unit *unit;
OguiWindow *win;
int unitNumber;
// NOTICE!!!
// There is no point in loading these images seperately for each
// unit window, as they all use the same images.
// For now, we'll just trust in storm3d to handle texture sharing
// properly.
// background
IOguiImage *unitBackImages[COMBATUNITWINDOW_UNIT_GROUPS];
IOguiImage *unitBackSelectedImages[COMBATUNITWINDOW_UNIT_GROUPS];
IOguiImage *unitBackDeadImages[COMBATUNITWINDOW_UNIT_GROUPS];
IOguiImage *unitBackHitImages[COMBATUNITWINDOW_UNIT_GROUPS];
IOguiImage *unitBackHitSelectedImages[COMBATUNITWINDOW_UNIT_GROUPS];
// weapon
IOguiImage *weapImage;
IOguiImage *weapSelectedImage;
IOguiImage *weapDownImage;
IOguiImage *weapSelectedDownImage;
IOguiImage *weapNoAmmoImage;
// mode
IOguiImage *modeDefensiveImage;
IOguiImage *modeDefensiveDownImage;
IOguiImage *modeAggressiveImage;
IOguiImage *modeAggressiveDownImage;
IOguiImage *modeHoldFireImage;
IOguiImage *modeHoldFireDownImage;
// energy, heat
//IOguiImage *energyImage;
//IOguiImage *maxEnergyImage;
//IOguiImage **heatImages;
//IOguiImage *heatOverlayImage;
//IOguiImage *energyOverlayImage;
//IOguiImage *unitHPImages[COMBATUNITWINDOW_UNIT_HP_IMAGES];
IOguiImage *unitHPBlockImage;
IOguiImage *unitEmptyHPBlockImage;
IOguiImage *unitEnergyBlockImage;
IOguiImage *unitEmptyEnergyBlockImage;
IOguiImage *unitClipBlockImage;
IOguiImage *unitEmptyClipBlockImage;
IOguiImage *heatImages[COMBATUNITWINDOW_HEAT_IMAGES];
IOguiImage *partHPImages[COMBATUNITWINDOW_PART_HP_IMGTYPES
* COMBATUNITWINDOW_PART_HP_IMAGES];
// the background
OguiButton *unitBackBut;
// face icon
OguiButton *characterFaceBut;
// unit name, group, mode and hp
OguiButton *unitNameBut;
OguiButton *unitModeBut;
//OguiButton *unitHPBut;
// shields
OguiButton *unitShieldBut;
OguiButton *unitHeatBut;
// weapons
OguiButton *unitWeapButs[COMBATUNITWINDOW_MAX_WEAPONS];
int lastUnitWeapAmmo[COMBATUNITWINDOW_MAX_WEAPONS];
// part HPs
OguiButton *unitPartHPButs[COMBATUNITWINDOW_MAX_PARTS];
int lastUnitPartHP[COMBATUNITWINDOW_MAX_PARTS];
// unit HP
OguiButton *unitHPBlockButs[COMBATUNITWINDOW_MAX_HPBLOCKS];
int lastUnitHP;
// unit energy
OguiButton *unitEnergyBlockButs[COMBATUNITWINDOW_MAX_ENERGYBLOCKS];
int lastUnitEnergy;
int unitSelectTime;
int blinkUnit;
//OguiButton *unitMaxEnergyBut;
//OguiButton *unitEnergyBut;
//OguiButton *unitHeatBut;
//OguiButton *unitEnergyOverlayBut;
//OguiButton *unitHeatOverlayBut;
};
}
#endif