mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
Rename R_CheckIfPatch
This commit is contained in:
parent
78cc4a78d0
commit
8863e13fde
3 changed files with 9 additions and 14 deletions
|
@ -603,7 +603,7 @@ texturefound:
|
|||
{
|
||||
flatfound:
|
||||
/* This could be a flat, patch, or PNG. */
|
||||
if (R_CheckIfPatch(flatnum))
|
||||
if (Patch_CheckIfDoom((patch_t *)W_CacheLumpNum(flatnum, PU_STATIC), W_LumpLength(flatnum)))
|
||||
levelflat->type = LEVELFLAT_PATCH;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -143,29 +143,23 @@ void *Patch_CreateGL(patch_t *patch)
|
|||
#endif // HWRENDER
|
||||
|
||||
//
|
||||
// R_CheckIfPatch
|
||||
// Patch_CheckIfDoom
|
||||
//
|
||||
// Returns true if the lump is a valid patch.
|
||||
// Returns true if the lump is a valid Doom patch.
|
||||
//
|
||||
boolean R_CheckIfPatch(lumpnum_t lump)
|
||||
boolean Patch_CheckIfDoom(softwarepatch_t *patch, size_t length)
|
||||
{
|
||||
size_t size;
|
||||
INT16 width, height;
|
||||
patch_t *patch;
|
||||
boolean result;
|
||||
|
||||
size = W_LumpLength(lump);
|
||||
|
||||
// minimum length of a valid Doom patch
|
||||
if (size < 13)
|
||||
if (length < 13)
|
||||
return false;
|
||||
|
||||
patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC);
|
||||
|
||||
width = SHORT(patch->width);
|
||||
height = SHORT(patch->height);
|
||||
|
||||
result = (height > 0 && height <= 16384 && width > 0 && width <= 16384 && width < (INT16)(size / 4));
|
||||
result = (height > 0 && height <= 16384 && width > 0 && width <= 16384 && width < (INT16)(length / 4));
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
@ -180,7 +174,7 @@ boolean R_CheckIfPatch(lumpnum_t lump)
|
|||
UINT32 ofs = LONG(patch->columnofs[x]);
|
||||
|
||||
// Need one byte for an empty column (but there's patches that don't know that!)
|
||||
if (ofs < (UINT32)width * 4 + 8 || ofs >= (UINT32)size)
|
||||
if (ofs < (UINT32)width * 4 + 8 || ofs >= (UINT32)length)
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
|
|
|
@ -46,8 +46,9 @@ void *Patch_AllocateHardwarePatch(patch_t *patch);
|
|||
void *Patch_CreateGL(patch_t *patch);
|
||||
#endif
|
||||
|
||||
boolean Patch_CheckIfDoom(softwarepatch_t *patch, size_t length);
|
||||
|
||||
// Conversions between patches / flats / textures...
|
||||
boolean R_CheckIfPatch(lumpnum_t lump);
|
||||
void R_TextureToFlat(size_t tex, UINT8 *flat);
|
||||
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
|
||||
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
|
||||
|
|
Loading…
Reference in a new issue