]> icculus.org git repositories - divverent/nexuiz.git/blob - scmenu/source/custom/joingame.qc
Added some menu images
[divverent/nexuiz.git] / scmenu / source / custom / joingame.qc
1 // Property of Alientrap/AK
2 // custom/joingame/joingame.qc
3
4 ////////////////////////////////////
5 // Item_Nex_HostCache_Entry
6 //////
7
8 void() Item_Nex_HostCache_Entry_Update =
9 {
10         if( HostCache_ViewCount <= self.stepValue ) {
11                 self.flag = self.flag | FLAG_HIDDEN;
12                 return;
13         } else if( self.flag & FLAG_HIDDEN )
14                 self.flag = self.flag - FLAG_HIDDEN;
15
16         if( Menu_HasRunFlag( self, RUNFLAG_CLIPPED ) )
17                 return;
18
19         Item_Button_Update();
20 };
21
22 void() Item_Nex_HostCache_Entry_Draw =
23 {
24         Item_Window_Draw();
25         Item_Button_Draw();
26 };
27
28 void() Item_Nex_HostCache_Entry_Spawn =
29 {
30         Item_Window_Spawn();
31         Item_Button_Spawn();
32
33         self.flag = self.flag | FLAG_HIDDEN; // we dont want to get this bloody hostcachestring warning
34         if( self.flag & FLAG_NOSELECT )
35                 self.flag = self.flag - FLAG_NOSELECT;
36         self._draw = Item_Nex_HostCache_Entry_Draw;
37         self._update = Item_Nex_HostCache_Entry_Update;
38 };
39
40 ////////////////////////////////////
41 // Item_Nex_HostCache_StringField
42 ////////
43
44 void() Item_Nex_HostCache_StringField_Update =
45 {
46         local float lMaxLen;
47
48         if( HostCache_ViewCount <= self._parent.stepValue )
49                 return;
50         lMaxLen = floor( self.size_x / self.fontSize_x );
51         String_EntitySet( self, text, gethostcachestring( self._realValue, self._parent.stepValue ) );
52         if( lMaxLen < strlen( self.text ) )
53                 String_EntitySet( self, text, strcat( substring( self.text, 0, lMaxLen - 3 ), "..." ) );
54
55         Item_Label_Update();
56 };
57
58 void() Item_Nex_HostCache_StringField_Spawn =
59 {
60         Item_Label_Spawn();
61
62         self._realValue = gethostcacheindexforkey( self.target );
63         self._update = Item_Nex_HostCache_StringField_Update;
64 };
65
66 ////////////////////////////////////
67 // Item_Nex_HostCache_ValueField
68 ////////
69
70 void() Item_Nex_HostCache_ValueField_Update =
71 {
72         if( HostCache_ViewCount <= self._parent.stepValue )
73                 return;
74         String_EntitySet( self, text, ftos( gethostcachenumber( self._realValue, self._parent.stepValue ) ) );
75
76         Item_Label_Update();
77 };
78
79 void() Item_Nex_HostCache_ValueField_Spawn =
80 {
81         Item_Label_Spawn();
82
83         self._realValue = gethostcacheindexforkey( self.target );
84         self._update = Item_Nex_HostCache_ValueField_Update;
85 };
86
87 //////////////////////////////////
88 // Item_Nex_HostCache_Players
89 ///////
90
91 void() Item_Nex_HostCache_Players_Update =
92 {
93         local string lNum, lMax;
94
95         if( HostCache_ViewCount <= self._parent.stepValue )
96                 return;
97         lNum = ftos( gethostcachenumber( SLIST_FIELD_NUMPLAYERS, self._parent.stepValue ) );
98         lMax = ftos( gethostcachenumber( SLIST_FIELD_MAXPLAYERS, self._parent.stepValue ) );
99
100         String_EntitySet( self, text, strcat( lNum, "/", lMax ) );
101
102         Item_Label_Update();
103 };
104
105 void() Item_Nex_HostCache_Players_Spawn =
106 {
107         Item_Label_Spawn();
108
109         self._update = Item_Nex_HostCache_Players_Update;
110 };