예제 #1
0
void TAstar::Sort(TList<TAstar>& L,int k)  
{  
    int n=L.Getlen();
	int i;  
    for( i=k+1;i<n;i++)  
    {  
        TAstar T=L.GetData(i);  
        if(this->f<=T.f)  
            break;  
    }  
    L.Insert(*this,i);  
}  
예제 #2
0
static void ScanQuake3Models(const char *path)
{
	/*----- get a list of directories -----*/
	// NOTE: use of FS_PATH_NAMES here will not allow to add new skins by mod for model from base dir
	CFileList *dirNames = GFileSystem->List(va("%s/models/players/*", path), FS_DIR);

	/*--- go through the subdirectories ---*/
	for (TListIterator<CFileItem> diritem = *dirNames; diritem; ++diritem)
	{
		if (pmiList.Find(diritem->name)) continue;	// already have model with the same name

		// verify the existence of animation.cfg
		if (!GFileSystem->FileExists(va("%s/models/players/%s/animation.cfg", path, diritem->name)))
			continue;
		// verify the existence of at least one skin file
		CFileList *skinNames = GFileSystem->List(va("%s/models/players/%s/lower_*.skin", path, diritem->name), FS_FILE|FS_NOEXT);

		// count valid skins
		TList<CStringItem> skins;
		int numSkins = 0;
		for (TListIterator<CFileItem> skinItem = *skinNames; skinItem; ++skinItem)
		{
			const char *str = skinItem->name + 6;	// skip "lower_"
			// check at least one model
			if (!GFileSystem->FileExists(va("%s/models/players/%s/lower.md3", path, diritem->name))) continue;
			// may be, have "icon_file.jpg" and "icon_file.tga" ...
			if (skins.Find(str)) continue;
			skins.CreateAndInsert(str, pmiChain);
			numSkins++;
		}
		delete skinNames;
		if (!numSkins) continue;

		// create model info
		playerModelInfo_t *info = new (diritem->name, pmiChain) playerModelInfo_t;
		info->numSkins = numSkins;
		info->skins    = skins;
		info->isQ3mdl  = true;
		// add model info to pmi
		pmiList.Insert(info);
		numPlayerModels++;
	}
	delete dirNames;
}
예제 #3
0
static void ScanQuake2Models(const char *path)
{
	/*----- get a list of directories -----*/
	// NOTE: use of FS_PATH_NAMES here will not allow to add new skins by mod for model from base dir
	CFileList *dirNames = GFileSystem->List(va("%s/players/*", path), FS_DIR);

	/*--- go through the subdirectories ---*/
	for (TListIterator<CFileItem> diritem = *dirNames; diritem; ++diritem)
	{
		if (pmiList.Find(diritem->name)) continue;	// already have model with the same name

		// verify the existence of tris.md2
		if (!GFileSystem->FileExists(va("%s/players/%s/tris.md2", path, diritem->name)))
			continue;
		// verify the existence of at least one pcx skin
		CFileList *skinNames = GFileSystem->List(va("%s/players/%s/*.pcx,*.tga,*.jpg", path, diritem->name), FS_FILE|FS_NOEXT); // images only

		// count valid skins, which consist of a skin with a matching "_i" icon
		TList<CStringItem> skins;
		int numSkins = 0;
		for (TListIterator<CFileItem> skinItem = *skinNames; skinItem; ++skinItem)
			if (Md2SkinExists(skinItem->name, skinNames))
			{
				skins.CreateAndInsert(skinItem->name, pmiChain);
				numSkins++;
			}
		delete skinNames;
		if (!numSkins) continue;

		// create model info
		playerModelInfo_t *info = new (diritem->name, pmiChain) playerModelInfo_t;
		info->numSkins = numSkins;
		info->skins    = skins;
		// add model info to pmi
		pmiList.Insert(info);
		numPlayerModels++;
	}
	delete dirNames;
}