1 // Property of Alientrap/AK
2 // custom/creategame/filelist.qc
4 //Item_DataLink_Nex_FileList [Item_DataLink_Switch]
11 void() IDLNFL_Sync = {
14 local float lMaskStart, lMaskedLength;
17 lHandle = search_begin( strcat( self.selected, "*.", self.normal ), true, true );
21 lCount = search_getsize( lHandle );
23 String_EntitySet( self, valueList, "" );
24 String_EntitySet( self, descList, "" );
26 lMaskStart = strlen( self.selected );
27 lMaskedLength = lMaskStart + strlen( self.normal) + 1; // +1 because of the '.'
28 for( lCounter = 0 ; lCounter < lCount ; lCounter++ ) {
29 local string lFilename;
31 lFilename = search_getfilename( lHandle, lCounter );
32 self.valueList = Util_AltStringPushBack( self.valueList, lFilename );
33 self.descList = Util_AltStringPushBack( self.descList, substring( lFilename, lMaskStart, strlen( lFilename ) - lMaskedLength ) );
39 self.maxValue = lCount - 1;
48 Item_DataLink_Nex_FileList_Destroy
51 void() Item_DataLink_Nex_FileList_Destroy =
53 String_EntityFree( self, valueList );
54 String_EntityFree( self, normal );
55 String_EntityFree( self, selected );
57 Item_DataLink_Switch_Destroy();
62 Item_DataLink_Nex_FileList_DataEvent
65 void( float pEvent ) Item_DataLink_Nex_FileList_DataEvent =
73 self._realValue = 0.0;
75 case ITEM_DATALINK_SET:
76 Item_DataLink_Value_Clamp();
78 case ITEM_DATALINK_GET:
79 String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self.descList, self._realValue ) ) );
86 Item_DataLink_Nex_FileList_Spawn
89 void() Item_DataLink_Nex_FileList_Spawn =
91 Item_DataLink_Switch_Init();
93 String_EntityCreate( self, valueList );
94 String_EntityZone( self, normal );
95 String_EntityZone( self, selected );
97 self._reinit = IDLNFL_Sync;
98 self._destroy = Item_DataLink_Nex_FileList_Destroy;
99 self._dataEvent = Item_DataLink_Nex_FileList_DataEvent;