]> icculus.org git repositories - divverent/nexuiz.git/blob - data/source/custom/credits.qm
restructure
[divverent/nexuiz.git] / data / source / custom / credits.qm
1 // Property of Alientrap/Ak
2 // custom/credits.qm
3
4 void() Nex_Credits_SetSizeX =
5 {
6         local entity lItem;
7
8         lItem = Menu_GetItem( "Credits" );
9         lItem.size_x = self._parent.size_x;
10 };
11
12 void() Nex_Credits_Scroll =
13 {
14         local entity lItem, lTarget;
15
16         lItem = Menu_GetItem( "Credits" );
17         lTarget = self._parent;
18
19         lTarget.origin = lTarget.origin - Timer_Delta * self.direction;
20         if( self.direction_x ) {
21                 if( lTarget.origin_x < -lItem.size_x )
22                         lTarget.origin_x = lTarget.size_x;
23                 if( lTarget.origin_x > lItem.size_x )
24                         lTarget.origin_x = -lItem.size_x;
25         }
26         if( self.direction_y ) {
27                 if( lTarget.origin_y < -lItem.size_y )
28                         lTarget.origin_y = lTarget.size_y;
29                 if( lTarget.origin_y > lItem.size_y )
30                         lTarget.origin_y = -lItem.size_y;
31         }
32 };
33
34 void() Nex_Credits_Toggle =
35 {
36         local entity lEntity;
37
38         lEntity = Menu_GetItem( "CreditsWnd" );
39         if( lEntity.flag & FLAG_HIDDEN ) {
40                 lEntity.flag = lEntity.flag - FLAG_HIDDEN;
41                 Menu_Select( Menu_GetItem( "CreditsWnd::Layout::Items::Close" ), false );
42         } else {
43                 lEntity.flag = lEntity.flag + FLAG_HIDDEN;
44                 Menu_Reselect( false );
45         }
46 }
47
48 bool( float pKey, float pAscii ) Nex_Credits_Key =
49 {
50         if( pKey == K_ESCAPE ) {
51                 Nex_Credits_Toggle();
52                 return true;
53         }
54         return false;
55 };
56
57 void() Nex_Credits_Action =
58 {
59         local entity lEntity;
60
61         lEntity = Menu_GetItem( "CreditsWnd" );
62         if( lEntity.flag & FLAG_HIDDEN )
63                 lEntity.flag = lEntity.flag - FLAG_HIDDEN;
64         Menu_Select( Menu_GetItem( "CreditsWnd::Layout::Items::Close" ), false );
65         lEntity = Menu_GetItem( "CreditsWnd::Layout::Items::Scroller" );
66         lEntity.origin_y = lEntity.size_y;
67 }