summaryrefslogtreecommitdiff
path: root/src/w_wad.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w_wad.c')
-rw-r--r--src/w_wad.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/w_wad.c b/src/w_wad.c
index 07cd9710..397ec457 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -175,9 +175,19 @@ FILE *W_AddFile (char *filename)
if (strcasecmp(filename+strlen(filename)-3 , "wad" ) )
{
// single lump file
+
+ // fraggle: Swap the filepos and size here. The WAD directory
+ // parsing code expects a little-endian directory, so will swap
+ // them back. Effectively we're constructing a "fake WAD directory"
+ // here, as it would appear on disk.
+
fileinfo = Z_Malloc(sizeof(filelump_t), PU_STATIC, 0);
- fileinfo->filepos = 0;
- fileinfo->size = FileLength(handle);
+ fileinfo->filepos = LONG(0);
+ fileinfo->size = LONG(FileLength(handle));
+
+ // Name the lump after the base of the filename (without the
+ // extension).
+
ExtractFileBase (filename, fileinfo->name);
numlumps++;
}