==================
*/
-string HUD_Panel_GetName(float id)
-{
- switch(id) {
- case 0: return "weaponicons"; break;
- case 1: return "inventory"; break;
- case 2: return "powerups"; break;
- case 3: return "healtharmor"; break;
- case 4: return "notify"; break;
- case 5: return "timer"; break;
- case 6: return "radar"; break;
- case 7: return "score"; break;
- case 8: return "racetimer"; break;
- case 9: return "vote"; break;
- case 10: return "modicons"; break;
- case 11: return "pressedkeys"; break;
- case 12: return "chat"; break;
- default: return "";
- }
-}
-
// Save the config
void HUD_Panel_ExportCfg(string cfgname)
{
// common cvars for all panels
float i;
- for (i = 0; i < panel_cnt; ++i)
+ for (i = 0; i < HUD_PANEL_NUM; ++i)
{
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), " ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i)))), "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_pos \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_pos")), "\"", "\n"));
myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
- for (i = 0; i < panel_cnt; ++i) {
+ for (i = 0; i < HUD_PANEL_NUM; ++i) {
if(i == id || !HUD_Panel_CheckActive(i))
continue;
myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
- for (i = 0; i < panel_cnt; ++i) {
+ for (i = 0; i < HUD_PANEL_NUM; ++i) {
if(i == id || !HUD_Panel_CheckActive(i))
continue;
float mouseClicked;
float prevMouseClicked; // previous state
+float prevMouseClickedTime; // time during previous mouse click, to check for doubleclicks
+vector prevMouseClickedPos; // pos during previous mouse click, to check for doubleclicks
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
{
if(!hud_configure)
if(mouseClicked)
{
+ if(time - prevMouseClickedTime < 0.4 && prevMouseClicked == 0 && prevMouseClickedPos == mousepos)
+ {
+ mouseClicked = 0; // to prevent spam, I guess.
+ print("Doubleclick!\n");
+ return;
+ }
+
float i, border;
vector panelPos;
vector panelSize;
- for(i = 0; i <= panel_cnt; ++i)
+ for(i = 0; i <= HUD_PANEL_NUM; ++i)
{
panelPos = HUD_Panel_GetPos(i);
panelSize = HUD_Panel_GetSize(i);
border = HUD_Panel_GetBorder(i);
if(prevMouseClicked == 0) {
+ prevMouseClickedTime = time;
+ prevMouseClickedPos = mousepos;
+
// move
if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y)
{
void HUD_WeaponIcons()
{
- float id = 0;
+ float id = HUD_PANEL_WEAPONICONS;
float alpha, stat_weapons; // "constants"
vector pos, mySize, accuracy_color;
float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables
void HUD_Inventory()
{
- float id = 1;
+ float id = HUD_PANEL_INVENTORY;
float i;
float stat_items;
// Powerups (#2)
//
void HUD_Powerups() {
- float id = 2;
+ float id = HUD_PANEL_POWERUPS;
float stat_items;
stat_items = getstati(STAT_ITEMS);
//
void HUD_HealthArmor(void)
{
- float id = 3;
+ float id = HUD_PANEL_HEALTHARMOR;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
void HUD_Notify (void)
{
- float id = 4;
+ float id = HUD_PANEL_NOTIFY;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
//
void HUD_Timer()
{
- float id = 5;
+ float id = HUD_PANEL_TIMER;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
//
void HUD_Radar(void)
{
- float id = 6;
+ float id = HUD_PANEL_RADAR;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
//
void HUD_Score()
{
- float id = 7;
+ float id = HUD_PANEL_SCORE;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
// Race timer (#8)
//
void HUD_RaceTimer (void) {
- float id = 8;
+ float id = HUD_PANEL_RACETIMER;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
void HUD_VoteWindow(void)
{
- float id = 9;
+ float id = HUD_PANEL_VOTE;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
if (gametype != GAME_KEYHUNT && gametype != GAME_CTF && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && !hud_configure)
return;
- float id = 10;
+ float id = HUD_PANEL_MODICONS;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
//
void HUD_DrawPressedKeys(void)
{
- float id = 11;
+ float id = HUD_PANEL_PRESSEDKEYS;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);
float chat_prevtime;
void HUD_Chat(void)
{
- float id = 12;
+ float id = HUD_PANEL_CHAT;
vector pos, mySize;
pos = HUD_Panel_GetPos(id);
mySize = HUD_Panel_GetSize(id);