Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

PluginEntities.cpp (2985B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 //-----------------------------------------------------------------------------
     23 //
     24 // $LogFile$
     25 // $Revision: 1.1.1.4 $
     26 // $Author: ttimo $
     27 // $Date: 2000/01/18 00:17:34 $
     28 // $Log: PluginEntities.cpp,v $
     29 // Revision 1.1.1.4  2000/01/18 00:17:34  ttimo
     30 // merging in for RC
     31 //
     32 // Revision 1.3  2000/01/17 23:53:42  TBesset
     33 // ready for merge in sourceforge (RC candidate)
     34 //
     35 // Revision 1.2  2000/01/07 16:40:11  TBesset
     36 // merged from BSP frontend
     37 //
     38 // Revision 1.1.1.3  1999/12/29 18:31:34  TBesset
     39 // Q3Radiant public version
     40 //
     41 // Revision 1.1.1.1.2.1  1999/12/29 21:39:38  TBesset
     42 // updated to update3 from Robert
     43 //
     44 // Revision 1.1.1.3  1999/12/29 18:31:34  TBesset
     45 // Q3Radiant public version
     46 // Revision 1.1.1.3  1999/12/29 18:31:34  TBesset
     47 // Q3Radiant public version
     48 //
     49 // Revision 1.2  1999/11/22 17:46:46  Timo & Christine
     50 // merged EARadiant into the main tree
     51 // bug fixes for Q3Plugin / EAPlugin
     52 // export for Robert
     53 //
     54 // Revision 1.1.2.1  1999/11/03 20:38:01  Timo & Christine
     55 // MEAN plugin for Q3Radiant, alpha version
     56 //
     57 //
     58 // DESCRIPTION:
     59 // implementation of IPluginEntities specific interface
     60 // 
     61 
     62 #include "stdafx.h"
     63 #include "io.h"
     64 
     65 // is Eclass_InitForModelDirectory
     66 int WINAPI QERApp_EClassScanDir( char *path, HMODULE hPlug )
     67 {
     68 	struct _finddata_t	fileinfo;
     69 	int					handle;
     70 	char				temp[ _MAX_PATH ];
     71 	char				filebase[ _MAX_PATH ];
     72 	char				filename[ _MAX_PATH ];
     73 	char				*s;
     74 	eclass_t			*e;
     75 	QE_ConvertDOSToUnixName( temp, path );
     76 	strcpy (filebase, path);
     77 	s = filebase + strlen(filebase)-1;
     78 	while (*s != '\\' && *s != '/' && s!=filebase)
     79 		s--;
     80 	*s = 0;
     81 	handle = _findfirst (path, &fileinfo);
     82 	if (handle != -1)
     83 	   {
     84 		do
     85 		{			
     86 			sprintf (filename, "%s\\%s", filebase, fileinfo.name);
     87 			Eclass_ScanFile (filename);
     88 			
     89 			if (eclass_found)
     90             {
     91 				e = eclass_e;
     92 				e->modelpath = strdup( fileinfo.name );
     93 				e->nShowFlags |= ECLASS_PLUGINENTITY;
     94 				e->hPlug = hPlug;
     95             }
     96 		} while (_findnext( handle, &fileinfo ) != -1);
     97 		
     98 		_findclose (handle);
     99 	   }
    100 	return 0;
    101 }