A bit more work on PK3.

-Expanded folder recognition for PK3s. Some resources are still not loaded from them yet.
-Took a glimpse at how maps are loaded, since the flat recognition is rooted somewhere there; did nothing yet about it though.
-Working towards "generalizing" how new resources are handled. Some var and functionality redundancy is still present.
This commit is contained in:
Nevur 2017-05-06 16:52:53 +02:00
parent b60010f0f1
commit 8ef6d6fd9e
6 changed files with 200 additions and 54 deletions

View file

@ -368,6 +368,38 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
return true;
}
// Auxiliary function for PK3 loading - Loads sprites from a specified range.
void R_LoadSpritsRange(UINT16 wadnum, UINT16 first, UINT16 num)
{
size_t i, addsprites = 0;
char wadname[MAX_WADPATH];
//
// scan through lumps, for each sprite, find all the sprite frames
//
for (i = 0; i < numsprites; i++)
{
spritename = sprnames[i];
if (spritename[4] && wadnum >= (UINT16)spritename[4])
continue;
if (R_AddSingleSpriteDef(spritename, &sprites[i], wadnum, first, first + num + 1))
{
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddSpriteMD2(i);
#endif
// if a new sprite was added (not just replaced)
addsprites++;
#ifndef ZDEBUG
CONS_Debug(DBG_SETUP, "sprite %s set in pwad %d\n", spritename, wadnum);
#endif
}
}
nameonly(strcpy(wadname, wadfiles[wadnum]->filename));
CONS_Printf(M_GetText("%s added %d frames in %s sprites\n"), wadname, num, sizeu1(addsprites));
}
//
// Search for sprites replacements in a wad whose names are in namelist
//