diff options
author | Simon Howard | 2011-03-28 21:32:14 +0000 |
---|---|---|
committer | Simon Howard | 2011-03-28 21:32:14 +0000 |
commit | d706f9693ee6bfd3976fcb232c1563c32b1cff88 (patch) | |
tree | 998596b01f3c0c5591359722f4c836a8a23d38d2 /src/w_wad.c | |
parent | 6e099632c653dd42dbe1f719c5887844091da0cc (diff) | |
download | chocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.tar.gz chocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.tar.bz2 chocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.zip |
Allow .lmp files to be loaded (and demo files to be played back) that
have long filenames (thanks blzut3).
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2312
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++); } } |