mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-18 10:31:42 +00:00
Remember when I said I'd stop for today? I lied.
-Lumps are loaded fine now. Essentially non-compressed PK3s are supported now.
This commit is contained in:
parent
e125dedbe9
commit
1b881afb99
1 changed files with 12 additions and 1 deletions
13
src/w_wad.c
13
src/w_wad.c
|
@ -462,11 +462,14 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
int namePos;
|
int namePos;
|
||||||
unsigned short int eNameLen = 8;
|
unsigned short int eNameLen = 8;
|
||||||
unsigned short int eXFieldLen = 0;
|
unsigned short int eXFieldLen = 0;
|
||||||
|
unsigned short int lNameLen = 0;
|
||||||
|
unsigned short int lXFieldLen = 0;
|
||||||
unsigned short int eCommentLen = 0;
|
unsigned short int eCommentLen = 0;
|
||||||
unsigned short int eCompression = 0;
|
unsigned short int eCompression = 0;
|
||||||
unsigned int eSize = 0;
|
unsigned int eSize = 0;
|
||||||
unsigned int eCompSize = 0;
|
unsigned int eCompSize = 0;
|
||||||
unsigned int eLocalHeaderOffset = 0;
|
unsigned int eLocalHeaderOffset = 0;
|
||||||
|
unsigned long int rememberPos = 0;
|
||||||
|
|
||||||
// We get the compression type indicator value.
|
// We get the compression type indicator value.
|
||||||
fseek(handle, 6, SEEK_CUR);
|
fseek(handle, 6, SEEK_CUR);
|
||||||
|
@ -490,7 +493,15 @@ UINT16 W_LoadWadFile(const char *filename)
|
||||||
else // Otherwise, reallocate and increase by 1. Might not be optimal, though...
|
else // Otherwise, reallocate and increase by 1. Might not be optimal, though...
|
||||||
lumpinfo = (lumpinfo_t*) Z_Realloc(lumpinfo, (numlumps + 1)*sizeof(*lumpinfo), PU_STATIC, NULL);
|
lumpinfo = (lumpinfo_t*) Z_Realloc(lumpinfo, (numlumps + 1)*sizeof(*lumpinfo), PU_STATIC, NULL);
|
||||||
|
|
||||||
lumpinfo[numlumps].position = eLocalHeaderOffset + 30 + eNameLen + eXFieldLen;
|
// We must calculate the position for the actual data.
|
||||||
|
// Why not eLocalHeaderOffset + 30 + eNameLen + eXFieldLen? That's because the extra field and name lengths MAY be different in the local headers.
|
||||||
|
rememberPos = ftell(handle);
|
||||||
|
fseek(handle, eLocalHeaderOffset + 26, SEEK_SET);
|
||||||
|
fread(&lNameLen, 1, 2, handle);
|
||||||
|
fread(&lXFieldLen, 1, 2, handle);
|
||||||
|
lumpinfo[numlumps].position = ftell(handle) + lNameLen + lXFieldLen;
|
||||||
|
|
||||||
|
fseek(handle, rememberPos, SEEK_SET); // Let's go back to the central dir.
|
||||||
lumpinfo[numlumps].disksize = eCompSize;
|
lumpinfo[numlumps].disksize = eCompSize;
|
||||||
lumpinfo[numlumps].size = eSize;
|
lumpinfo[numlumps].size = eSize;
|
||||||
CONS_Printf("Address: %ld, Full: %ld, Comp: %ld\n", lumpinfo[numlumps].position, lumpinfo[numlumps].size, lumpinfo[numlumps].disksize);
|
CONS_Printf("Address: %ld, Full: %ld, Comp: %ld\n", lumpinfo[numlumps].position, lumpinfo[numlumps].size, lumpinfo[numlumps].disksize);
|
||||||
|
|
Loading…
Reference in a new issue