smol optimization to skin loading
This commit is contained in:
1 parent
ab3ea7475f
commit
ea3b4ddeb0
1 file changed
+42
-50
+42
-50
@@ -275,58 +275,50 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
|
||||
|
||||
for (l = startlump; l < endlump; l++)
|
||||
{
|
||||
if (memcmp(lumpinfo[l].name,sprname,4)==0)
|
||||
if (memcmp(lumpinfo[l].name,sprname,4))
|
||||
continue;
|
||||
|
||||
frame = R_Char2Frame(lumpinfo[l].name[4]);
|
||||
rotation = (UINT8)(lumpinfo[l].name[5] - '0');
|
||||
|
||||
if (frame >= 64 || !(R_ValidSpriteAngle(rotation))) // Give an actual NAME error -_-...
|
||||
{
|
||||
frame = R_Char2Frame(lumpinfo[l].name[4]);
|
||||
rotation = (UINT8)(lumpinfo[l].name[5] - '0');
|
||||
|
||||
if (frame >= 64 || !(R_ValidSpriteAngle(rotation))) // Give an actual NAME error -_-...
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Bad sprite name: %s\n"), W_CheckNameForNumPwad(wadnum,l));
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip NULL sprites from very old dmadds pwads
|
||||
if (W_LumpLengthPwad(wadnum,l)<=8)
|
||||
continue;
|
||||
|
||||
// store sprite info in lookup tables
|
||||
//FIXME : numspritelumps do not duplicate sprite replacements
|
||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, sizeof (patch_t), 0);
|
||||
spritecachedinfo[numspritelumps].width = SHORT(patch.width)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].offset = SHORT(patch.leftoffset)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].topoffset = SHORT(patch.topoffset)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].height = SHORT(patch.height)<<FRACBITS;
|
||||
|
||||
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
||||
if (rendermode != render_none) // not for psprite
|
||||
spritecachedinfo[numspritelumps].topoffset += 4<<FRACBITS;
|
||||
|
||||
// Being selective with this causes bad things. :( Like the special stage tokens breaking apart.
|
||||
/*if (rendermode != render_none // not for psprite
|
||||
&& SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height))
|
||||
// perfect is patch.height but sometime it is too high
|
||||
spritecachedinfo[numspritelumps].topoffset = min(SHORT(patch.topoffset)+4,SHORT(patch.height))<<FRACBITS;*/
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 0);
|
||||
|
||||
if (lumpinfo[l].name[6])
|
||||
{
|
||||
frame = R_Char2Frame(lumpinfo[l].name[6]);
|
||||
rotation = (UINT8)(lumpinfo[l].name[7] - '0');
|
||||
R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 1);
|
||||
}
|
||||
|
||||
if (++numspritelumps >= max_spritelumps)
|
||||
{
|
||||
max_spritelumps *= 2;
|
||||
Z_Realloc(spritecachedinfo, max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo);
|
||||
}
|
||||
|
||||
++numadded;
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Bad sprite name: %s\n"), W_CheckNameForNumPwad(wadnum,l));
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip NULL sprites from very old dmadds pwads
|
||||
if (W_LumpLengthPwad(wadnum,l)<=8)
|
||||
continue;
|
||||
|
||||
// store sprite info in lookup tables
|
||||
//FIXME : numspritelumps do not duplicate sprite replacements
|
||||
W_ReadLumpHeaderPwad(wadnum, l, &patch, sizeof (patch_t), 0);
|
||||
spritecachedinfo[numspritelumps].width = SHORT(patch.width)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].offset = SHORT(patch.leftoffset)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].topoffset = SHORT(patch.topoffset)<<FRACBITS;
|
||||
spritecachedinfo[numspritelumps].height = SHORT(patch.height)<<FRACBITS;
|
||||
|
||||
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
||||
if (rendermode != render_none) // not for psprite
|
||||
spritecachedinfo[numspritelumps].topoffset += FEETADJUST;
|
||||
|
||||
R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 0);
|
||||
|
||||
if (lumpinfo[l].name[6])
|
||||
{
|
||||
frame = R_Char2Frame(lumpinfo[l].name[6]);
|
||||
rotation = (UINT8)(lumpinfo[l].name[7] - '0');
|
||||
R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 1);
|
||||
}
|
||||
|
||||
if (++numspritelumps >= max_spritelumps)
|
||||
{
|
||||
max_spritelumps *= 2;
|
||||
Z_Realloc(spritecachedinfo, max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo);
|
||||
}
|
||||
|
||||
++numadded;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user