[q3map2] import pk3dir/dpk/dpkdir support from netradiant

- load every pk3dir/dpkdir as VFS
- increase VFS_MAXDIR
- dpk/dpkdir is not versionned yet
This commit is contained in:
Thomas Debesse 2017-08-06 02:17:58 +02:00
parent ba300b1751
commit c99c1abd9b
2 changed files with 15 additions and 2 deletions

View file

@ -197,8 +197,21 @@ void vfsInitDirectory( const char *path ){
dirlist = g_strdup( name ); dirlist = g_strdup( name );
{ {
char *ext = strrchr( dirlist, '.' ); char *ext = strrchr( dirlist, '.' );
if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 ) ) {
if ( ext && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) {
if ( g_numDirs == VFS_MAXDIRS ) {
continue;
}
snprintf( g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name );
g_strDirs[g_numDirs][PATH_MAX] = '\0';
vfsFixDOSName( g_strDirs[g_numDirs] );
vfsAddSlash( g_strDirs[g_numDirs] );
++g_numDirs;
}
if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) {
continue; continue;
} }
} }

View file

@ -31,7 +31,7 @@
#ifndef _VFS_H_ #ifndef _VFS_H_
#define _VFS_H_ #define _VFS_H_
#define VFS_MAXDIRS 8 #define VFS_MAXDIRS 64
void vfsInitDirectory( const char *path ); void vfsInitDirectory( const char *path );
void vfsShutdown(); void vfsShutdown();