]> icculus.org git repositories - divverent/nexuiz.git/blob - data/menuqc/custom/key.qm
Revert first change in the trunk.
[divverent/nexuiz.git] / data / menuqc / custom / key.qm
1 // Property of Alientrap
2 // custom/key.qm
3
4 // link is the name of the datalink
5 .string target;
6 // text is the description text
7 .string text;
8
9 /*
10 ===================
11 Nex_Automation_Key
12 ===================
13 */
14 // Embedded in a window with the following subitems: Action, Link1, Link2
15 void() Nex_Automation_Key =
16 {
17         local entity lAction, lLink1, lLink2;
18
19         if( !self._parent.target ) {
20                 objerror( "Bad target '", self._parent.target, "'" );
21                 return;
22         }
23
24         // Get the children
25         lAction = Menu_GetItem( "Action" );
26         lLink1 = Menu_GetItem( "Link1" );
27         lLink2 = Menu_GetItem( "Link2" );
28
29         // Now set the properties
30         // (will be strzoned later by the Spawn functions)
31         lAction.text = self._parent.text;
32
33         lLink1.link = self._parent.target;
34         lLink2.link = self._parent.target;
35 };
36
37 // more specific functions
38 // Menu_KeyHook_Target points to Link1/2
39 void( float pKey, float pAscii ) Nex_Key_KeyHook =
40 {
41         local entity lItem;
42         if( pKey != K_ESCAPE ) {
43                 String_EntitySet( Menu_KeyHook_Target, value, ftos( pKey ) );
44                 Raise_DataEvent( Menu_KeyHook_Target, ITEM_DATALINK_SET );
45                 Raise_DataEvent( Menu_KeyHook_Target, ITEM_DATA_TEST_START );
46         }
47         // hide the info window again
48         lItem = Menu_GetItemEx( Menu_KeyHook_Target, "InfoWindow", true );
49         lItem.flag = lItem.flag | FLAG_HIDDEN;
50
51         Menu_KeyHook = Util_NullFunction;
52 };
53
54 void() Nex_Action_KeyButton =
55 {
56         local entity lItem;
57
58         Menu_KeyHook_Target = self._target._link;
59         Menu_KeyHook = Nex_Key_KeyHook;
60
61         // show the info window
62         lItem = Menu_GetItem( "InfoWindow" );
63         lItem.flag = lItem.flag - (lItem.flag & FLAG_HIDDEN);
64 };
65