diff options
Diffstat (limited to 'src/w_wad.c')
-rw-r--r-- | src/w_wad.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/w_wad.c b/src/w_wad.c index 9425705c..e93147e3 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -74,27 +74,38 @@ static lumpinfo_t **lumphash; static void ExtractFileBase(char *path, char *dest) { - char* src; - int length; + char *src; + char *filename; + int length; src = path + strlen(path) - 1; - + // back up until a \ or the start while (src != path && *(src - 1) != DIR_SEPARATOR) { src--; } - - // copy up to eight characters - memset (dest,0,8); + + filename = src; + + // Copy up to eight characters + // Note: Vanilla Doom exits with an error if a filename is specified + // with a base of more than eight characters. To remove the 8.3 + // filename limit, instead we simply truncate the name. + length = 0; - - while (*src && *src != '.') + memset(dest, 0, 8); + + while (*src != '\0' && *src != '.') { - if (++length == 9) - I_Error ("Filename base of %s >8 chars",path); + if (length >= 8) + { + printf("Warning: Truncated '%s' lump name to '%.8s'.\n", + filename, dest); + break; + } - *dest++ = toupper((int)*src++); + dest[length++] = toupper((int)*src++); } } |