1 // Property of Alientrap/AK
2 // custom/player/avatar.qm
10 void() Item_Nex_Map_Info_Destroy =
12 String_EntityFree( self, link );
13 String_EntityFree( self, picture );
14 String_EntityFree( self, text );
15 String_EntityFree( self, normal );
18 void() Item_Nex_Map_Info_Spawn =
20 String_EntityZone( self, link );
21 String_EntityZone( self, picture );
22 String_EntityZone( self, text );
23 String_EntityZone( self, normal );
25 Gfx_Precache( self.picture );
27 self._destroy = Item_Nex_Map_Info_Destroy;
37 // Nex_Action_Map_BuildAvatarList
38 // model definition format
43 // rest: description text
44 void() _IDNM_BuildList =
46 local float lSearchHandle;
47 local float lSearchSize;
48 local float lSearchCounter;
51 Menu_EmptyWindow( self );
53 lSearchHandle = search_begin( "maps/*.bsp", true, true );
54 if( lSearchHandle < 0 )
56 for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0;
57 lSearchCounter < lSearchSize; ++lSearchCounter ) {
60 local string lFilename;
61 local string lStripped;
63 local string lDescription;
65 lFilename = search_getfilename( lSearchHandle, lSearchCounter );
66 lStripped = String_Zone( substring( lFilename, 0, strlen( lFilename ) - 4 ) );
67 lName = String_Zone( substring( lStripped, 5, 100000 ) );
69 lHandle = fopen( strcat( lStripped, ".txt" ), FILE_READ );
71 lDescription = String_Zone( strcat( "--NO INFORMATION AVAILABLE--\n", lFilename ) );
73 lDescription = String_Create();
77 lLine = fgets( lHandle );
78 lDescription = String_Append( lDescription, strcat( lLine, "\n" ) );
79 } while( validstring( lLine ) );
84 // add this avatar_info
85 lMap = Menu_CreateItem( "Item_Nex_Map_Info", ftos( lSearchCounter ), self.name );
88 lMap.picture = lStripped;
90 lMap.text = lDescription;
92 Menu_LinkItem( lMap );
95 String_Free( lStripped );
96 String_Free( lDescription );
99 search_end( lSearchHandle );
101 Menu_LinkChildren( self );
105 self.maxValue = fabs( lMap.orderPos );
108 void() _IDNM_UpdateLink =
110 local float lCurrent;
114 lCurrent = fabs( self._link.orderPos );
115 lTarget = self._realValue;
116 if( lCurrent < lTarget )
117 for( lMatch = self._link; lMatch._next && fabs( lMatch.orderPos ) != lTarget; lMatch = lMatch._next );
119 for( lMatch = self._link; lMatch._prev && fabs( lMatch.orderPos ) != lTarget; lMatch = lMatch._prev );
120 // lMatch always is valid if there are any children
123 self._realValue = fabs( self._link.orderPos );
124 String_EntitySet( self, value, ftos( self._realValue ) );
129 String_EntitySet( self, value, ftos( self._realValue ) );
130 String_EntitySet( self, _syncValue, ftos( self._realValue ) );
136 String_EntitySet( self, _syncValue, self.value );
139 void() _IDNM_Test_Start =
144 void() _IDNM_Test_End =
146 String_EntitySet( self, value, self._syncValue );
152 String_EntitySet( self, value, self.defValue );
156 void( float pEvent ) Item_Data_Nex_Map_DataEvent =
165 case ITEM_DATA_RESET:
168 case ITEM_DATA_TEST_START:
171 case ITEM_DATA_TEST_END:
174 case ITEM_DATALINK_SET:
180 void() Item_Data_Nex_Map_Spawn =
184 self.flag = self.flag | FLAG_HIDDEN;
186 self._dataEvent = Item_Data_Nex_Map_DataEvent;
190 self._link = self._child;
191 self._realValue = stof( self.defValue );