From c99c1abd9b6aa6b645193be310c3cdcc987bb330 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sun, 6 Aug 2017 02:17:58 +0200 Subject: [PATCH] [q3map2] import pk3dir/dpk/dpkdir support from netradiant - load every pk3dir/dpkdir as VFS - increase VFS_MAXDIR - dpk/dpkdir is not versionned yet --- tools/quake3/common/vfs.c | 15 ++++++++++++++- tools/quake3/common/vfs.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index bbe536bc..b796e21e 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -197,8 +197,21 @@ void vfsInitDirectory( const char *path ){ dirlist = g_strdup( name ); { + 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; } } diff --git a/tools/quake3/common/vfs.h b/tools/quake3/common/vfs.h index ca41a294..3a8705cb 100644 --- a/tools/quake3/common/vfs.h +++ b/tools/quake3/common/vfs.h @@ -31,7 +31,7 @@ #ifndef _VFS_H_ #define _VFS_H_ -#define VFS_MAXDIRS 8 +#define VFS_MAXDIRS 64 void vfsInitDirectory( const char *path ); void vfsShutdown();