]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/ready_restart_tweaks' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 23 Jan 2015 01:34:35 +0000 (01:34 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 23 Jan 2015 01:34:35 +0000 (01:34 +0000)
Terencehill/ready restart tweaks

Improve behaviour when sv_ready_restart and sv_ready_restart_after_countdown are enabled:

* Don't play "Prepare for battle" announcement twice in games made of rounds

* Block players while the countdown to game start is going even if sv_ready_restart_after_countdown is enabled
This is to avoid that a player roaming in the map gets confused by the sudden respawn when the game begins; it also helps to more clearly separate pre-game time from pre-round time (in the latter players are allowed to move depending on the game mode, e.g. CA allows it, FT doesn't)

See merge request !88

38 files changed:
gfx/hud/default/kh_blue.tga [deleted file]
gfx/hud/default/kh_blue_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_blue_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_bluearrow.tga [deleted file]
gfx/hud/default/kh_dropped.tga [new file with mode: 0644]
gfx/hud/default/kh_pink.tga [deleted file]
gfx/hud/default/kh_pink_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_pink_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_pinkarrow.tga [deleted file]
gfx/hud/default/kh_red.tga [deleted file]
gfx/hud/default/kh_red_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_red_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_redarrow.tga [deleted file]
gfx/hud/default/kh_yellow.tga [deleted file]
gfx/hud/default/kh_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_yellow_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_yellowarrow.tga [deleted file]
gfx/hud/old/kh_blue.tga [deleted file]
gfx/hud/old/kh_bluearrow.tga [deleted file]
gfx/hud/old/kh_pink.tga [deleted file]
gfx/hud/old/kh_pinkarrow.tga [deleted file]
gfx/hud/old/kh_red.tga [deleted file]
gfx/hud/old/kh_redarrow.tga [deleted file]
gfx/hud/old/kh_yellow.tga [deleted file]
gfx/hud/old/kh_yellowarrow.tga [deleted file]
qcsrc/client/hud.qc
qcsrc/menu/item/listbox.c
qcsrc/menu/xonotic/campaign.c
qcsrc/menu/xonotic/demolist.c
qcsrc/menu/xonotic/keybinder.c
qcsrc/menu/xonotic/languagelist.c
qcsrc/menu/xonotic/maplist.c
qcsrc/menu/xonotic/playlist.c
qcsrc/menu/xonotic/screenshotlist.c
qcsrc/menu/xonotic/serverlist.c
qcsrc/menu/xonotic/skinlist.c
qcsrc/menu/xonotic/soundlist.c
qcsrc/menu/xonotic/statslist.c

diff --git a/gfx/hud/default/kh_blue.tga b/gfx/hud/default/kh_blue.tga
deleted file mode 100644 (file)
index 467b229..0000000
Binary files a/gfx/hud/default/kh_blue.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_blue_carrying.tga b/gfx/hud/default/kh_blue_carrying.tga
new file mode 100644 (file)
index 0000000..a1ad7ae
Binary files /dev/null and b/gfx/hud/default/kh_blue_carrying.tga differ
diff --git a/gfx/hud/default/kh_blue_taken.tga b/gfx/hud/default/kh_blue_taken.tga
new file mode 100644 (file)
index 0000000..bb855cc
Binary files /dev/null and b/gfx/hud/default/kh_blue_taken.tga differ
diff --git a/gfx/hud/default/kh_bluearrow.tga b/gfx/hud/default/kh_bluearrow.tga
deleted file mode 100644 (file)
index b686d1b..0000000
Binary files a/gfx/hud/default/kh_bluearrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_dropped.tga b/gfx/hud/default/kh_dropped.tga
new file mode 100644 (file)
index 0000000..a6df016
Binary files /dev/null and b/gfx/hud/default/kh_dropped.tga differ
diff --git a/gfx/hud/default/kh_pink.tga b/gfx/hud/default/kh_pink.tga
deleted file mode 100644 (file)
index b40967a..0000000
Binary files a/gfx/hud/default/kh_pink.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_pink_carrying.tga b/gfx/hud/default/kh_pink_carrying.tga
new file mode 100644 (file)
index 0000000..61053a5
Binary files /dev/null and b/gfx/hud/default/kh_pink_carrying.tga differ
diff --git a/gfx/hud/default/kh_pink_taken.tga b/gfx/hud/default/kh_pink_taken.tga
new file mode 100644 (file)
index 0000000..e7c642f
Binary files /dev/null and b/gfx/hud/default/kh_pink_taken.tga differ
diff --git a/gfx/hud/default/kh_pinkarrow.tga b/gfx/hud/default/kh_pinkarrow.tga
deleted file mode 100644 (file)
index 17427e5..0000000
Binary files a/gfx/hud/default/kh_pinkarrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_red.tga b/gfx/hud/default/kh_red.tga
deleted file mode 100644 (file)
index 3201f8a..0000000
Binary files a/gfx/hud/default/kh_red.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_red_carrying.tga b/gfx/hud/default/kh_red_carrying.tga
new file mode 100644 (file)
index 0000000..e52d33d
Binary files /dev/null and b/gfx/hud/default/kh_red_carrying.tga differ
diff --git a/gfx/hud/default/kh_red_taken.tga b/gfx/hud/default/kh_red_taken.tga
new file mode 100644 (file)
index 0000000..66a96a3
Binary files /dev/null and b/gfx/hud/default/kh_red_taken.tga differ
diff --git a/gfx/hud/default/kh_redarrow.tga b/gfx/hud/default/kh_redarrow.tga
deleted file mode 100644 (file)
index edd1fab..0000000
Binary files a/gfx/hud/default/kh_redarrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_yellow.tga b/gfx/hud/default/kh_yellow.tga
deleted file mode 100644 (file)
index bb83475..0000000
Binary files a/gfx/hud/default/kh_yellow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_yellow_carrying.tga b/gfx/hud/default/kh_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..17b051f
Binary files /dev/null and b/gfx/hud/default/kh_yellow_carrying.tga differ
diff --git a/gfx/hud/default/kh_yellow_taken.tga b/gfx/hud/default/kh_yellow_taken.tga
new file mode 100644 (file)
index 0000000..b4a3d32
Binary files /dev/null and b/gfx/hud/default/kh_yellow_taken.tga differ
diff --git a/gfx/hud/default/kh_yellowarrow.tga b/gfx/hud/default/kh_yellowarrow.tga
deleted file mode 100644 (file)
index 8e754cc..0000000
Binary files a/gfx/hud/default/kh_yellowarrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_blue.tga b/gfx/hud/old/kh_blue.tga
deleted file mode 100644 (file)
index 467b229..0000000
Binary files a/gfx/hud/old/kh_blue.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_bluearrow.tga b/gfx/hud/old/kh_bluearrow.tga
deleted file mode 100644 (file)
index b686d1b..0000000
Binary files a/gfx/hud/old/kh_bluearrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_pink.tga b/gfx/hud/old/kh_pink.tga
deleted file mode 100644 (file)
index b40967a..0000000
Binary files a/gfx/hud/old/kh_pink.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_pinkarrow.tga b/gfx/hud/old/kh_pinkarrow.tga
deleted file mode 100644 (file)
index 17427e5..0000000
Binary files a/gfx/hud/old/kh_pinkarrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_red.tga b/gfx/hud/old/kh_red.tga
deleted file mode 100644 (file)
index 3201f8a..0000000
Binary files a/gfx/hud/old/kh_red.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_redarrow.tga b/gfx/hud/old/kh_redarrow.tga
deleted file mode 100644 (file)
index edd1fab..0000000
Binary files a/gfx/hud/old/kh_redarrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_yellow.tga b/gfx/hud/old/kh_yellow.tga
deleted file mode 100644 (file)
index bb83475..0000000
Binary files a/gfx/hud/old/kh_yellow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_yellowarrow.tga b/gfx/hud/old/kh_yellowarrow.tga
deleted file mode 100644 (file)
index 8e754cc..0000000
Binary files a/gfx/hud/old/kh_yellowarrow.tga and /dev/null differ
index 9e6861ebd06e7d05a4a0fabfc4c305dc4433c3c3..471817a4347b276b8f78ceb11d4c89d0e46f1fff 100644 (file)
@@ -2910,148 +2910,132 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 }
 
 // Keyhunt HUD modicon section
-float kh_runheretime;
-
-void HUD_Mod_KH_Reset(void)
-{
-       kh_runheretime = 0;
-}
+vector KH_SLOTS[4];
 
 void HUD_Mod_KH(vector pos, vector mySize)
 {
        mod_active = 1; // keyhunt should never hide the mod icons panel
-       float kh_keys;
-       float keyteam;
-       float a, aa;
-       vector p = '0 0 0', pa, kh_size = '0 0 0', kh_asize = '0 0 0';
 
-       kh_keys = getstati(STAT_KH_KEYS);
+       // Read current state
 
-       p_x = pos_x;
-       if(mySize_x > mySize_y)
-       {
-               p_y = pos_y + 0.25 * mySize_y;
-               pa = p - eY * 0.25 * mySize_y;
+       float state = getstati(STAT_KH_KEYS);
+       float i, key_state;
+       float all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys;
+       all_keys = team1_keys = team2_keys = team3_keys = team4_keys = dropped_keys = carrying_keys = 0;
 
-               kh_size_x = mySize_x * 0.25;
-               kh_size_y = 0.75 * mySize_y;
-               kh_asize_x = mySize_x * 0.25;
-               kh_asize_y = mySize_y * 0.25;
-       }
-       else
+       for(i = 0; i < 4; ++i)
        {
-               p_y = pos_y + 0.125 * mySize_y;
-               pa = p - eY * 0.125 * mySize_y;
+               key_state = (bitshift(state, i * -5) & 31) - 1;
 
-               kh_size_x = mySize_x * 0.5;
-               kh_size_y = 0.375 * mySize_y;
-               kh_asize_x = mySize_x * 0.5;
-               kh_asize_y = mySize_y * 0.125;
-       }
+               if(key_state == -1)
+                       continue;
 
-       float i, key;
+               if(key_state == 30)
+               {
+                       ++carrying_keys;
+                       key_state = myteam;
+               }
 
-       float keycount;
-       keycount = 0;
-       for(i = 0; i < 4; ++i)
-       {
-               key = floor(kh_keys / pow(32, i)) & 31;
-               keyteam = key - 1;
-               if(keyteam == 30 && keycount <= 4)
-                       keycount += 4;
-               if(keyteam == myteam || keyteam == -1 || keyteam == 30)
-                       keycount += 1;
+               switch(key_state)
+               {
+                       case NUM_TEAM_1: ++team1_keys; break;
+                       case NUM_TEAM_2: ++team2_keys; break;
+                       case NUM_TEAM_3: ++team3_keys; break;
+                       case NUM_TEAM_4: ++team4_keys; break;
+                       case 29: ++dropped_keys; break;
+               }
+
+               ++all_keys;
        }
 
-       // this yields 8 exactly if "RUN HERE" shows
+       // Calculate slot measurements
+
+       vector slot_size;
 
-       if(keycount == 8)
+       if(all_keys == 4 && mySize_x * 0.5 < mySize_y && mySize_y * 0.5 < mySize_x)
        {
-               if(!kh_runheretime)
-                       kh_runheretime = time;
-               pa_y -= fabs(sin((time - kh_runheretime) * 3.5)) * 6; // make the arrows jump in case of RUN HERE
+               // Quadratic arrangement
+               slot_size = eX * mySize_x * 0.5 + eY * mySize_y * 0.5;
+               KH_SLOTS[0] = pos;
+               KH_SLOTS[1] = pos + eX * slot_size_x;
+               KH_SLOTS[2] = pos + eY * slot_size_y;
+               KH_SLOTS[3] = pos + eX * slot_size_x + eY * slot_size_y;
        }
        else
-               kh_runheretime = 0;
-
-       for(i = 0; i < 4; ++i)
        {
-               key = floor(kh_keys / pow(32, i)) & 31;
-               keyteam = key - 1;
-               switch(keyteam)
+               if(mySize_x > mySize_y)
                {
-                       case 30: // my key
-                               keyteam = myteam;
-                               a = 1;
-                               aa = 1;
-                               break;
-                       case -1: // no key
-                               a = 0;
-                               aa = 0;
-                               break;
-                       default: // owned or dropped
-                               a = 0.2;
-                               aa = 0.5;
-                               break;
+                       // Horizontal arrangement
+                       slot_size = eX * mySize_x / all_keys + eY * mySize_y;
+                       for(i = 0; i < all_keys; ++i)
+                               KH_SLOTS[i] = pos + eX * slot_size_x * i;
                }
-               a = a * panel_fg_alpha;
-               aa = aa * panel_fg_alpha;
-               if(a > 0)
+               else
                {
-                       switch(keyteam)
-                       {
-                               case NUM_TEAM_1:
-                                       drawpic_aspect_skin(pa, "kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_2:
-                                       drawpic_aspect_skin(pa, "kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_3:
-                                       drawpic_aspect_skin(pa, "kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_4:
-                                       drawpic_aspect_skin(pa, "kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               default:
-                                       break;
-                       }
-                       switch(i) // YAY! switch(i) inside a for loop for i. DailyWTF, here we come!
-                       {
-                               case 0:
-                                       drawpic_aspect_skin(p, "kh_red", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 1:
-                                       drawpic_aspect_skin(p, "kh_blue", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 2:
-                                       drawpic_aspect_skin(p, "kh_yellow", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 3:
-                                       drawpic_aspect_skin(p, "kh_pink", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                       }
+                       // Vertical arrangement
+                       slot_size = eX * mySize_x + eY * mySize_y / all_keys;
+                       for(i = 0; i < all_keys; ++i)
+                               KH_SLOTS[i] = pos + eY * slot_size_y * i;
                }
-               if(mySize_x > mySize_y)
+       }
+
+       // Make icons blink in case of RUN HERE
+
+       float blink = 0.6 + sin(2*M_PI*time) / 2.5; // Oscillate between 0.2 and 1
+       float alpha;
+       alpha = 1;
+
+       if(carrying_keys)
+               switch(myteam)
+               {
+                       case NUM_TEAM_1: if(team1_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_2: if(team2_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_3: if(team3_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_4: if(team4_keys == all_keys) alpha = blink; break;
+               }
+
+       // Draw icons
+
+       i = 0;
+
+       while(team1_keys--)
+               if(myteam == NUM_TEAM_1 && carrying_keys)
+               {
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
+               }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team2_keys--)
+               if(myteam == NUM_TEAM_2 && carrying_keys)
                {
-                       p_x += 0.25 * mySize_x;
-                       pa_x += 0.25 * mySize_x;
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
                }
                else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team3_keys--)
+               if(myteam == NUM_TEAM_3 && carrying_keys)
                {
-                       if(i == 1)
-                       {
-                               p_y = pos_y + 0.625 * mySize_y;
-                               pa_y = pos_y + 0.5 * mySize_y;
-                               p_x = pos_x;
-                               pa_x = pos_x;
-                       }
-                       else
-                       {
-                               p_x += 0.5 * mySize_x;
-                               pa_x += 0.5 * mySize_x;
-                       }
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
                }
-       }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team4_keys--)
+               if(myteam == NUM_TEAM_4 && carrying_keys)
+               {
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
+               }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(dropped_keys--)
+               drawpic_aspect_skin(KH_SLOTS[i++], "kh_dropped", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
 }
 
 // Keepaway HUD mod icon
@@ -4482,9 +4466,7 @@ Main HUD system
 void HUD_Reset (void)
 {
        // reset gametype specific icons
-       if(gametype == MAPINFO_TYPE_KEYHUNT)
-               HUD_Mod_KH_Reset();
-       else if(gametype == MAPINFO_TYPE_CTF)
+       if(gametype == MAPINFO_TYPE_CTF)
                HUD_Mod_CTF_Reset();
 }
 
index d4eaab2a7b8277e51866df26756550f5c6378c8c..275b99735b72529f974f015519770192fdb51509 100644 (file)
@@ -35,8 +35,13 @@ CLASS(ListBox) EXTENDS(Item)
        ATTRIB(ListBox, itemHeight, float, 0)
        ATTRIB(ListBox, colorBG, vector, '0 0 0')
        ATTRIB(ListBox, alphaBG, float, 0)
+
+       ATTRIB(ListBox, lastClickedItem, float, -1)
+       ATTRIB(ListBox, lastClickedTime, float, 0)
+
        METHOD(ListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
        METHOD(ListBox, clickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
+       METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
        METHOD(ListBox, setSelected, void(entity, float))
 
        METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float))
@@ -260,7 +265,15 @@ float ListBox_mouseRelease(entity me, vector pos)
                // and give it a nice click event
                if(me.nItems > 0)
                {
-                       me.clickListBoxItem(me, me.selectedItem, globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem)));
+                       vector where = globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem));
+
+                       if((me.selectedItem == me.lastClickedItem) && (time < me.lastClickedTime + 0.3))
+                               me.doubleClickListBoxItem(me, me.selectedItem, where);
+                       else
+                               me.clickListBoxItem(me, me.selectedItem, where);
+
+                       me.lastClickedItem = me.selectedItem;
+                       me.lastClickedTime = time;
                }
        }
        me.pressed = 0;
@@ -374,7 +387,12 @@ void ListBox_draw(entity me)
 
 void ListBox_clickListBoxItem(entity me, float i, vector where)
 {
-       // itemclick, itemclick, does whatever itemclick does
+       // template method
+}
+
+void ListBox_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       // template method
 }
 
 void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
index 454b4ad710ba660764384042c17edbd398038456..126b728c8fc1a563f12e6cbeb603b348ebf5cd42 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticCampaignList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
        METHOD(XonoticCampaignList, draw, void(entity))
        METHOD(XonoticCampaignList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticCampaignList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticCampaignList, setSelected, void(entity, float))
        METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float))
@@ -24,9 +24,6 @@ CLASS(XonoticCampaignList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
        ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
 
-       ATTRIB(XonoticCampaignList, lastClickedMap, float, -1)
-       ATTRIB(XonoticCampaignList, lastClickedTime, float, 0)
-
        ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
        ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
        ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
@@ -233,18 +230,9 @@ void XonoticCampaignList_resizeNotify(entity me, vector relOrigin, vector relSiz
 
        rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
 }
-void XonoticCampaignList_clickListBoxItem(entity me, float i, vector where)
+void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedMap)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       // start game
-                       CampaignList_LoadMap(me, me);
-                       return;
-               }
-       me.lastClickedMap = i;
-       me.lastClickedTime = time;
+       CampaignList_LoadMap(me, me);
 }
 void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {
index f2e209ca4d2b38190cdc64ec1f382f4756e4569d..9f5909676298fc15dc2e08027bf374d1cbf3afb1 100644 (file)
@@ -8,7 +8,7 @@ CLASS(XonoticDemoList) EXTENDS(XonoticListBox)
        METHOD(XonoticDemoList, startDemo, void(entity))
        METHOD(XonoticDemoList, timeDemo, void(entity))
        METHOD(XonoticDemoList, demoName, string(entity, float))
-       METHOD(XonoticDemoList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticDemoList, keyDown, float(entity, float, float, float))
        METHOD(XonoticDemoList, destroy, void(entity))
        METHOD(XonoticDemoList, showNotify, void(entity))
@@ -21,8 +21,6 @@ CLASS(XonoticDemoList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
        ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
 
-       ATTRIB(XonoticDemoList, lastClickedDemo, float, -1)
-       ATTRIB(XonoticDemoList, lastClickedTime, float, 0)
        ATTRIB(XonoticDemoList, filterString, string, string_null)
 ENDCLASS(XonoticDemoList)
 
@@ -207,17 +205,9 @@ void DemoConfirm_ListClick_Check_Gamestatus(entity me)
        }
 }
 
-void XonoticDemoList_clickListBoxItem(entity me, float i, vector where)
+void XonoticDemoList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedDemo)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       DemoConfirm_ListClick_Check_Gamestatus(me);
-               }
-       me.lastClickedDemo = i;
-       me.lastClickedTime = time;
+       DemoConfirm_ListClick_Check_Gamestatus(me);
 }
 
 float XonoticDemoList_keyDown(entity me, float scan, float ascii, float shift)
index c312e382656105a4824bd3b6e3c3568df0ee36ae..60c44ddaf2436e8f6214b96c4641f0b54c46e3dc 100644 (file)
@@ -3,7 +3,7 @@ CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
        METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
        ATTRIB(XonoticKeyBinder, rowsPerItem, float, 1)
        METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticKeyBinder, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticKeyBinder, setSelected, void(entity, float))
        METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float))
@@ -16,8 +16,6 @@ CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
        ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
        ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
 
-       ATTRIB(XonoticKeyBinder, lastClickedKey, float, -1)
-       ATTRIB(XonoticKeyBinder, lastClickedTime, float, 0)
        ATTRIB(XonoticKeyBinder, previouslySelected, float, -1)
        ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
        ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
@@ -245,16 +243,9 @@ void KeyBinder_Bind_Reset_All(entity btn, entity me)
        localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
        cvar_set("_hud_showbinds_reload", "1");
 }
-void XonoticKeyBinder_clickListBoxItem(entity me, float i, vector where)
+void XonoticKeyBinder_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedKey)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       KeyBinder_Bind_Change(NULL, me);
-               }
-       me.lastClickedKey = i;
-       me.lastClickedTime = time;
+       KeyBinder_Bind_Change(NULL, me);
 }
 void XonoticKeyBinder_setSelected(entity me, float i)
 {
index 24445786aea98b696c0c1c84b926d6ac29cafc2c..38b8098ae0da2619d456ee0099e1c83a52fd271d 100644 (file)
@@ -15,10 +15,8 @@ CLASS(XonoticLanguageList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
        ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
 
-       METHOD(XonoticLanguageList, clickListBoxItem, void(entity, float, vector)) // double click handling
+       METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)) // enter handling
-       ATTRIB(XonoticLanguageList, lastClickedLanguage, float, -1)
-       ATTRIB(XonoticLanguageList, lastClickedTime, float, 0)
 
        METHOD(XonoticLanguageList, destroy, void(entity))
 
@@ -140,17 +138,9 @@ void XonoticLanguageList_saveCvars(entity me)
        cvar_set("_menu_prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID));
 }
 
-void XonoticLanguageList_clickListBoxItem(entity me, float i, vector where)
+void XonoticLanguageList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedLanguage)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.setLanguage(me);
-               }
-       me.lastClickedLanguage = i;
-       me.lastClickedTime = time;
+       me.setLanguage(me);
 }
 
 float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
index 60eeb445c6c4877caf508aa145ccf9c403d9e5ef..e05c7644f4885ed724ba2e9b570159c02f7dcc3e 100644 (file)
@@ -5,6 +5,7 @@ CLASS(XonoticMapList) EXTENDS(XonoticListBox)
        METHOD(XonoticMapList, draw, void(entity))
        METHOD(XonoticMapList, drawListBoxItem, void(entity, float, vector, float))
        METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticMapList, refilter, void(entity))
        METHOD(XonoticMapList, refilterCallback, void(entity, entity))
@@ -20,9 +21,6 @@ CLASS(XonoticMapList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
        ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
 
-       ATTRIB(XonoticMapList, lastClickedMap, float, -1)
-       ATTRIB(XonoticMapList, lastClickedTime, float, 0)
-
        ATTRIB(XonoticMapList, lastGametype, float, 0)
        ATTRIB(XonoticMapList, lastFeatures, float, 0)
 
@@ -144,21 +142,16 @@ void XonoticMapList_clickListBoxItem(entity me, float i, vector where)
        if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize)
                if(where_x >= 0)
                        me.g_maplistCacheToggle(me, i);
+}
 
+void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
+{
        if(where_x >= me.columnNameOrigin)
                if(where_x <= 1)
                {
-                       if(i == me.lastClickedMap)
-                               if(time < me.lastClickedTime + 0.3)
-                               {
-                                       // DOUBLE CLICK!
-                                       // pop up map info screen
-                                       main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
-                                       DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
-                                       return;
-                               }
-                       me.lastClickedMap = i;
-                       me.lastClickedTime = time;
+                       // pop up map info screen
+                       main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
+                       DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
                }
 }
 
index 80fe3132e25eb9a9bea30353bdc38203d35678fe..e3cd56dc538f47b0f6db8b38bf6fdcfd2715df99 100644 (file)
@@ -9,7 +9,7 @@ CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
        METHOD(XonoticPlayList, startSound, void(entity, float))
        METHOD(XonoticPlayList, resumeSound, void(entity))
        METHOD(XonoticPlayList, pauseSound, void(entity))
-       METHOD(XonoticPlayList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticPlayList, keyDown, float(entity, float, float, float))
        METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
 
@@ -25,9 +25,6 @@ CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
        ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
        ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticPlayList, lastClickedSound, float, -1)
-       ATTRIB(XonoticPlayList, lastClickedTime, float, 0)
 ENDCLASS(XonoticPlayList)
 
 entity makeXonoticPlayList();
@@ -279,17 +276,9 @@ void PauseSound_Click(entity btn, entity me)
        me.pauseSound(me);
 }
 
-void XonoticPlayList_clickListBoxItem(entity me, float i, vector where)
+void XonoticPlayList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedSound)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.startSound(me, 0);
-               }
-       me.lastClickedSound = i;
-       me.lastClickedTime = time;
+       me.startSound(me, 0);
 }
 
 float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)
index dd8b61ed3f97fc942a456ef2799939c1f9e17f2a..c8f3becfa03c69a9b47c57cd489c2ebf078a78b8 100644 (file)
@@ -10,7 +10,7 @@ CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
        METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
        METHOD(XonoticScreenshotList, startScreenshot, void(entity))
        METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
-       METHOD(XonoticScreenshotList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float))
        METHOD(XonoticScreenshotList, destroy, void(entity))
        METHOD(XonoticScreenshotList, showNotify, void(entity))
@@ -21,8 +21,6 @@ CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
        ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
        ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
-       ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
        ATTRIB(XonoticScreenshotList, filterString, string, string_null)
        ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
        ATTRIB(XonoticScreenshotList, filterTime, float, 0)
@@ -280,18 +278,9 @@ void StartScreenshot_Click(entity btn, entity me)
        me.startScreenshot(me);
 }
 
-void XonoticScreenshotList_clickListBoxItem(entity me, float i, vector where)
+void XonoticScreenshotList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedScreenshot)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       // pop up screenshot
-                       me.setSelected(me, i);
-                       me.startScreenshot(me);
-               }
-       me.lastClickedScreenshot = i;
-       me.lastClickedTime = time;
+       me.startScreenshot(me);
 }
 
 float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float shift)
index 8b3a9e9a0394caf9f443e27499ce37d46aea4556..c78cba0e0667c931bb7d5ed23b40a256adf0c4da 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticServerList, rowsPerItem, float, 1)
        METHOD(XonoticServerList, draw, void(entity))
        METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticServerList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
        METHOD(XonoticServerList, toggleFavorite, void(entity, string))
@@ -49,8 +49,6 @@ CLASS(XonoticServerList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticServerList, infoButton, entity, NULL)
        ATTRIB(XonoticServerList, currentSortOrder, float, 0)
        ATTRIB(XonoticServerList, currentSortField, float, -1)
-       ATTRIB(XonoticServerList, lastClickedServer, float, -1)
-       ATTRIB(XonoticServerList, lastClickedTime, float, 0)
 
        ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
 
@@ -722,11 +720,7 @@ void XonoticServerList_draw(entity me)
                {
                        if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
                        {
-                               if(i != me.selectedItem)
-                               {
-                                       me.lastClickedServer = -1;
-                                       me.selectedItem = i;
-                               }
+                               me.selectedItem = i;
                                found = 1;
                                break;
                        }
@@ -962,16 +956,9 @@ void ServerList_Info_Click(entity btn, entity me)
        vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
        DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
 }
-void XonoticServerList_clickListBoxItem(entity me, float i, vector where)
+void XonoticServerList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedServer)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       ServerList_Connect_Click(NULL, me);
-               }
-       me.lastClickedServer = i;
-       me.lastClickedTime = time;
+       ServerList_Connect_Click(NULL, me);
 }
 void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
 {
index 0387303ea3d2a041f7c91cf09ecc1c6c811b8d66..034fb2584098490d291fd2eb123160e02a21970f 100644 (file)
@@ -9,7 +9,7 @@ CLASS(XonoticSkinList) EXTENDS(XonoticListBox)
        METHOD(XonoticSkinList, loadCvars, void(entity))
        METHOD(XonoticSkinList, saveCvars, void(entity))
        METHOD(XonoticSkinList, skinParameter, string(entity, float, float))
-       METHOD(XonoticSkinList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticSkinList, keyDown, float(entity, float, float, float))
        METHOD(XonoticSkinList, destroy, void(entity))
 
@@ -24,9 +24,6 @@ CLASS(XonoticSkinList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
        ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
 
-       ATTRIB(XonoticSkinList, lastClickedSkin, float, -1)
-       ATTRIB(XonoticSkinList, lastClickedTime, float, 0)
-
        ATTRIB(XonoticSkinList, name, string, "skinselector")
 ENDCLASS(XonoticSkinList)
 
@@ -182,17 +179,9 @@ void SetSkin_Click(entity btn, entity me)
        me.setSkin(me);
 }
 
-void XonoticSkinList_clickListBoxItem(entity me, float i, vector where)
+void XonoticSkinList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedSkin)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.setSkin(me);
-               }
-       me.lastClickedSkin = i;
-       me.lastClickedTime = time;
+       me.setSkin(me);
 }
 
 float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
index e45e486dcf039a29057b2b54f27603d1819ea69a..7d1515062ab5428aa09b0c272272aa4722a2f4c7 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
        METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
        METHOD(XonoticSoundList, getSounds, void(entity))
        METHOD(XonoticSoundList, soundName, string(entity, float))
-       METHOD(XonoticSoundList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticSoundList, keyDown, float(entity, float, float, float))
        METHOD(XonoticSoundList, destroy, void(entity))
        METHOD(XonoticSoundList, showNotify, void(entity))
@@ -21,8 +21,6 @@ CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
        ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
 
-       ATTRIB(XonoticSoundList, lastClickedSound, float, -1)
-       ATTRIB(XonoticSoundList, lastClickedTime, float, 0)
        ATTRIB(XonoticSoundList, filterString, string, string_null)
        ATTRIB(XonoticSoundList, playlist, entity, world)
 ENDCLASS(XonoticSoundList)
@@ -159,17 +157,9 @@ void SoundList_Add_All(entity box, entity me)
                me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
 }
 
-void XonoticSoundList_clickListBoxItem(entity me, float i, vector where)
+void XonoticSoundList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedSound)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
-               }
-       me.lastClickedSound = i;
-       me.lastClickedTime = time;
+       me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
 }
 
 float XonoticSoundList_keyDown(entity me, float scan, float ascii, float shift)
index 988244816c94534c554e221fd26773e3f9076b63..c7b744a66710697c02782151b8607edda74d1ab8 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticStatsList) EXTENDS(XonoticListBox)
        METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticStatsList, drawListBoxItem, void(entity, float, vector, float))
        METHOD(XonoticStatsList, getStats, void(entity))
-       METHOD(XonoticStatsList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
        METHOD(XonoticStatsList, destroy, void(entity))
        METHOD(XonoticStatsList, showNotify, void(entity))
@@ -15,9 +15,6 @@ CLASS(XonoticStatsList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
        ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
        ATTRIB(XonoticStatsList, columnNameSize, float, 0)
-
-       ATTRIB(XonoticStatsList, lastClickedDemo, float, -1)
-       ATTRIB(XonoticStatsList, lastClickedTime, float, 0)
 ENDCLASS(XonoticStatsList)
 
 entity statslist; // for reference elsewhere
@@ -333,17 +330,9 @@ void XonoticStatsList_showNotify(entity me)
        PlayerStats_PlayerDetail_CheckUpdate();
 }
 
-void XonoticStatsList_clickListBoxItem(entity me, float i, vector where)
+void XonoticStatsList_doubleClickListBoxItem(entity me, float i, vector where)
 {
-       if(i == me.lastClickedDemo)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       //DemoConfirm_ListClick_Check_Gamestatus(me);
-               }
-       me.lastClickedDemo = i;
-       me.lastClickedTime = time;
+       //DemoConfirm_ListClick_Check_Gamestatus(me);
 }
 
 float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)