completly borked remove flats port

Completey fucked color and brightmap handling for floors.
This commit is contained in:
NepDisk 2025-05-24 23:36:32 -04:00
parent 0a453db80d
commit c7cbc27efb
11 changed files with 238 additions and 683 deletions

View file

@ -515,9 +515,6 @@ extern int compuncommitted;
#define NO_PNG_LUMPS
#endif
/// Render flats on walls
#define WALLFLATS
/// Divide volume of music and sounds by this much (loudest sounds on earth)
#define VOLUME_DIVIDER 4
#define USER_VOLUME_SCALE 2

View file

@ -521,7 +521,6 @@ static void HWR_GenerateTexture(GLMapTexture_t *grtex, INT32 texnum, boolean noe
realpatch = (softwarepatch_t *)Picture_PNGConvert(pdata, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
else
#endif
#ifdef WALLFLATS
if (texture->type == TEXTURETYPE_FLAT)
{
if (doremap)
@ -529,7 +528,6 @@ static void HWR_GenerateTexture(GLMapTexture_t *grtex, INT32 texnum, boolean noe
realpatch = (softwarepatch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_DOOMPATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
}
else
#endif
{
dealloc = false;
if (doremap)
@ -767,7 +765,7 @@ void HWR_LoadMapTextures(size_t pnumtextures)
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
if ((gl_textures == NULL) || (gl_flats == NULL))
if (gl_textures == NULL || gl_flats == NULL)
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures");
gl_maptexturesloaded = true;
@ -896,36 +894,6 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
flat[steppy] = grMipmap->colormap->source[flat[steppy]];
}
static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum, boolean noencoremap)
{
UINT8 *flat;
UINT8 *converted;
size_t size;
size_t i;
UINT8 *colormap = colormaps;
if (!noencoremap && encoremap)
{
colormap += COLORMAP_REMAPOFFSET;
}
// setup the texture info
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->width = (UINT16)textures[texturenum]->width;
grMipmap->height = (UINT16)textures[texturenum]->height;
size = (grMipmap->width * grMipmap->height);
flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
converted = (UINT8 *)Picture_TextureToFlat(texturenum);
for (i = 0; i < size; i++)
{
flat[i] = colormap[converted[i]];
}
Z_Free(converted);
}
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
@ -966,125 +934,80 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
{
// Who knows?
if (levelflat == NULL)
return;
if (levelflat->type == LEVELFLAT_FLAT)
HWR_GetRawFlat(levelflat->u.flat.lumpnum, noencoremap);
else if (levelflat->type == LEVELFLAT_TEXTURE)
if (levelflat->type == LEVELFLAT_NONE)
{
GLMapTexture_t *grtex;
INT32 texturenum = levelflat->u.texture.num;
#ifdef PARANOIA
if ((unsigned)texturenum >= gl_numtextures)
I_Error("HWR_GetLevelFlat: texturenum >= numtextures");
#endif
HWR_SetCurrentTexture(NULL);
return;
}
// Who knows?
if (texturenum == 0 || texturenum == -1)
return;
INT32 texturenum = texturetranslation[levelflat->texture_id];
INT32 brightmapnum = R_GetTextureBrightmap(texturenum);
if (texturenum <= 0)
{
HWR_SetCurrentTexture(NULL);
return;
}
// Every texture in memory, stored as a 8-bit flat. Wow!
grtex = &gl_flats[texturenum];
GLMapTexture_t *grtex = &gl_flats[texturenum];
GLMipmap_t *grMipmap = &grtex->mipmap;
// Generate flat if missing from the cache
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
if (!grMipmap->data && !grMipmap->downloaded)
{
UINT8 *colormap = colormaps;
if (!noencoremap && encoremap)
{
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum, noencoremap);
if (!noencoremap && encoremap)
{
grtex->mipmap.colormap = Z_Calloc(sizeof(*grtex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
grtex->mipmap.colormap->source = colormaps + COLORMAP_REMAPOFFSET;
M_Memcpy(grtex->mipmap.colormap->data, colormaps + COLORMAP_REMAPOFFSET, 256);
}
colormap += COLORMAP_REMAPOFFSET;
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grtex->mipmap.downloaded)
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->width = (UINT16)textures[texturenum]->width;
grMipmap->height = (UINT16)textures[texturenum]->height;
size_t size = grMipmap->width * grMipmap->height;
memcpy(Z_Malloc(size, PU_HWRCACHE, &grMipmap->data), R_GetFlatForTexture(texturenum), size);
if (!noencoremap && encoremap)
{
grtex->mipmap.colormap = Z_Calloc(sizeof(*grtex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
grtex->mipmap.colormap->source = colormaps + COLORMAP_REMAPOFFSET;
M_Memcpy(grtex->mipmap.colormap->data, colormaps + COLORMAP_REMAPOFFSET, 256);
}
}
if (!grMipmap->downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
if (brightmapnum)
{
grtex = &gl_flats[brightmapnum];
grMipmap = &grtex->mipmap;
if (!grMipmap->data && !grMipmap->downloaded)
{
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
grMipmap->width = (UINT16)textures[brightmapnum]->width;
grMipmap->height = (UINT16)textures[brightmapnum]->height;
size_t size = grMipmap->width * grMipmap->height;
memcpy(Z_Malloc(size, PU_HWRCACHE, &grMipmap->data), R_GetFlatForTexture(brightmapnum), size);
}
if (!grMipmap->downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
if ((texturenum = R_GetTextureBrightmap(texturenum)))
{
// Every texture in memory, stored as a 8-bit flat. Wow!
grtex = &gl_flats[texturenum];
// Generate flat if missing from the cache
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum, true);
grtex->mipmap.flags |= TF_BRIGHTMAP;
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
}
Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
}
else if (levelflat->type == LEVELFLAT_PATCH)
{
patch_t *patch = W_CachePatchNum(levelflat->u.flat.lumpnum, PU_CACHE);
levelflat->width = (UINT16)(patch->width);
levelflat->height = (UINT16)(patch->height);
HWR_GetPatch(patch);
}
#ifndef NO_PNG_LUMPS
else if (levelflat->type == LEVELFLAT_PNG)
{
GLMipmap_t *mipmap = levelflat->mipmap;
// Cache the picture.
if (!levelflat->mippic)
{
INT32 pngwidth = 0, pngheight = 0;
void *pic = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
Z_ChangeTag(pic, PU_LEVEL);
Z_SetUser(pic, &levelflat->mippic);
levelflat->width = (UINT16)pngwidth;
levelflat->height = (UINT16)pngheight;
}
// Make the mipmap.
if (mipmap == NULL)
{
mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_STATIC, NULL);
mipmap->format = GL_TEXFMT_P_8;
mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
levelflat->mipmap = mipmap;
}
if (!mipmap->data && !mipmap->downloaded)
{
UINT8 *flat;
size_t size;
if (levelflat->mippic == NULL)
I_Error("HWR_GetLevelFlat: levelflat->mippic == NULL");
mipmap->width = levelflat->width;
mipmap->height = levelflat->height;
size = (mipmap->width * mipmap->height);
flat = Z_Malloc(size, PU_LEVEL, &mipmap->data);
M_Memcpy(flat, levelflat->mippic, size);
}
// Tell the hardware driver to bind the current texture to the flat's mipmap
HWR_SetCurrentTexture(mipmap);
}
#endif
else // set no texture
HWR_SetCurrentTexture(NULL);
}
// --------------------+

View file

@ -396,8 +396,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
INT32 i;
float flatxref,flatyref;
float fflatwidth = 64.0f, fflatheight = 64.0f;
INT32 flatflag = 63;
boolean texflat = false;
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
@ -452,34 +450,16 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
// set texture for polygon
if (levelflat != NULL)
{
if (levelflat->type == LEVELFLAT_FLAT)
{
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
size_t sflatsize = R_FlatDimensionsFromLumpSize(len);
fflatwidth = fflatheight = (double)sflatsize;
flatflag = sflatsize-1;
}
else
{
if (levelflat->type == LEVELFLAT_TEXTURE)
{
fflatwidth = textures[levelflat->u.texture.num]->width;
fflatheight = textures[levelflat->u.texture.num]->height;
}
else if (levelflat->type == LEVELFLAT_PATCH || levelflat->type == LEVELFLAT_PNG)
{
fflatwidth = levelflat->width;
fflatheight = levelflat->height;
}
texflat = true;
}
texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
fflatwidth = texture->width;
fflatheight = texture->height;
}
else // set no texture
HWR_SetCurrentTexture(NULL);
// reference point for flat texture coord for each vertex around the polygon
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatwidth);
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatheight);
flatxref = 0.0;
flatyref = 0.0;
// transform
if (FOFsector != NULL)
@ -514,30 +494,13 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
}
if (angle) // Only needs to be done if there's an altered angle
{
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
}
anglef = ANG2RAD(InvAngle(angle));
#define SETUP3DVERT(vert, vx, vy) {\
/* Hurdler: add scrolling texture on floor/ceiling */\
if (texflat)\
{\
vert->s = (float)((vx) / fflatwidth) + scrollx;\
vert->t = -(float)((vy) / fflatheight) + scrolly;\
}\
else\
{\
vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
}\
\
/* Hurdler: add scrolling texture on floor/ceiling */ \
vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
\
/* Need to rotate before translate */\
if (angle) /* Only needs to be done if there's an altered angle */\
{\
@ -2479,9 +2442,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
float height = FIXED_TO_FLOAT(fixedheight); // constant y for all points on the convex flat polygon
float flatxref, flatyref;
float fflatwidth = 64.0f, fflatheight = 64.0f;
INT32 flatflag = 63;
boolean texflat = false;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
@ -2509,37 +2469,16 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
// set texture for polygon
if (levelflat != NULL)
{
if (levelflat->type == LEVELFLAT_FLAT)
{
size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
size_t sflatsize = R_FlatDimensionsFromLumpSize(len);
fflatwidth = fflatheight = (double)sflatsize;
flatflag = sflatsize-1;
}
else
{
if (levelflat->type == LEVELFLAT_TEXTURE)
{
fflatwidth = textures[levelflat->u.texture.num]->width;
fflatheight = textures[levelflat->u.texture.num]->height;
}
else if (levelflat->type == LEVELFLAT_PATCH || levelflat->type == LEVELFLAT_PNG)
{
fflatwidth = levelflat->width;
fflatheight = levelflat->height;
}
texflat = true;
}
texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
fflatwidth = texture->width;
fflatheight = texture->height;
}
else // set no texture
HWR_SetCurrentTexture(NULL);
// reference point for flat texture coord for each vertex around the polygon
flatxref = FIXED_TO_FLOAT(polysector->origVerts[0].x);
flatyref = FIXED_TO_FLOAT(polysector->origVerts[0].y);
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatwidth);
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatheight);
flatxref = 0.0;
flatyref = 0.0;
// transform
v3d = planeVerts;
@ -2575,44 +2514,19 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
}
}
if (angle) // Only needs to be done if there's an altered angle
{
angle = (InvAngle(angle))>>ANGLETOFINESHIFT;
// This needs to be done so that it scrolls in a different direction after rotation like software
/*tempxs = FLOAT_TO_FIXED(scrollx);
tempyt = FLOAT_TO_FIXED(scrolly);
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));*/
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
tempxs = FLOAT_TO_FIXED(flatxref);
tempyt = FLOAT_TO_FIXED(flatyref);
flatxref = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
flatyref = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));
}
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
{
// Go from the polysector's original vertex locations
// Means the flat is offset based on the original vertex locations
if (texflat)
{
v3d->s = (float)(FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) + scrollx;
v3d->t = -(float)(FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly;
}
else
{
v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
}
v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
// Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle
{
tempxs = FLOAT_TO_FIXED(v3d->s);
tempyt = FLOAT_TO_FIXED(v3d->t);
angle = ANG2RAD(InvAngle(angle));
v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
v3d->t = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));
}

View file

@ -539,13 +539,8 @@ size_t P_PrecacheLevelFlats(void)
flatmemory = 0;
for (i = 0; i < numlevelflats; i++)
{
if (levelflats[i].type == LEVELFLAT_FLAT)
{
lump = levelflats[i].u.flat.lumpnum;
if (devparm)
flatmemory += W_LumpLength(lump);
R_GetFlat(lump);
}
if (levelflats[i].type != LEVELFLAT_NONE)
R_GetFlat(&levelflats[i]);
}
return flatmemory;
}
@ -557,18 +552,8 @@ or NULL if we want to allocate it now.
static INT32
Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
{
#ifndef NO_PNG_LUMPS
UINT8 buffer[8];
#endif
lumpnum_t flatnum;
int texturenum;
UINT8 *flatpatch;
size_t lumplength;
size_t i;
// Scan through the already found flats, return if it matches.
for (i = 0; i < numlevelflats; i++)
for (size_t i = 0; i < numlevelflats; i++)
{
if (strnicmp(levelflat[i].name, flatname, 8) == 0)
return i;
@ -592,65 +577,38 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name);
/* If we can't find a flat, try looking for a texture! */
if (( flatnum = R_GetFlatNumForName(levelflat->name) ) == LUMPERROR)
{
if (( texturenum = R_CheckTextureNumForName(levelflat->name) ) == -1)
{
// check for REDWALL
if (( texturenum = R_CheckTextureNumForName(MISSING_TEXTURE) ) != -1)
goto texturefound;
// check for REDFLR
else if (( flatnum = R_GetFlatNumForName(MISSING_TEXTURE) ) != LUMPERROR)
goto flatfound;
// nevermind
levelflat->type = LEVELFLAT_NONE;
}
else
{
texturefound:
levelflat->type = LEVELFLAT_TEXTURE;
levelflat->u.texture. num = texturenum;
levelflat->u.texture.lastnum = texturenum;
/* start out unanimated */
levelflat->u.texture.basenum = -1;
}
}
else
{
flatfound:
/* This could be a flat, patch, or PNG. */
flatpatch = W_CacheLumpNum(flatnum, PU_CACHE);
lumplength = W_LumpLength(flatnum);
if (Picture_CheckIfDoomPatch((softwarepatch_t *)flatpatch, lumplength))
levelflat->type = LEVELFLAT_PATCH;
else
{
#ifndef NO_PNG_LUMPS
/*
Only need eight bytes for PNG headers.
FIXME: Put this elsewhere.
*/
W_ReadLumpHeader(flatnum, buffer, 8, 0);
if (Picture_IsLumpPNG(buffer, lumplength))
levelflat->type = LEVELFLAT_PNG;
else
#endif/*NO_PNG_LUMPS*/
levelflat->type = LEVELFLAT_FLAT;/* phew */
}
if (flatpatch)
Z_Free(flatpatch);
levelflat->type = LEVELFLAT_TEXTURE;
levelflat->u.flat. lumpnum = flatnum;
levelflat->u.flat.baselumpnum = LUMPERROR;
// Look for a flat
int texturenum = R_CheckFlatNumForName(levelflat->name);
if (texturenum <= 0)
{
// If we can't find a flat, try looking for a texture!
texturenum = R_CheckTextureNumForName(levelflat->name);
if (texturenum <= 0)
{
// Use "not found" texture
texturenum = R_CheckTextureNumForName("REDWALL");
// Give up?
if (texturenum <= 0)
{
levelflat->type = LEVELFLAT_NONE;
texturenum = -1;
}
}
}
levelflat->texture_id = texturenum;
levelflat->terrain =
K_GetTerrainForTextureName(levelflat->name);
#ifndef ZDEBUG
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
#endif
return ( numlevelflats++ );
return numlevelflats++;
}
// Auxiliary function. Find a flat in the active wad files,
@ -3784,9 +3742,6 @@ static boolean P_LoadMapData(const virtres_t *virt)
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
// search for animated flats and set up
P_SetupLevelFlatAnims();
TracyCZoneEnd(__zone);
return true;
}

View file

@ -54,9 +54,6 @@ extern mapnamespace_t mapnamespace;
enum
{
LEVELFLAT_NONE,/* HOM time my friend */
LEVELFLAT_FLAT,
LEVELFLAT_PATCH,
LEVELFLAT_PNG,
LEVELFLAT_TEXTURE,
};
@ -66,43 +63,9 @@ enum
struct levelflat_t
{
char name[9]; // resource name from wad
UINT8 type;
union
{
struct
{
lumpnum_t lumpnum; // lump number of the flat
// for flat animation
lumpnum_t baselumpnum;
}
flat;
struct
{
INT32 num;
INT32 lastnum; // texture number of the flat
// for flat animation
INT32 basenum;
}
texture;
}
u;
UINT16 width, height;
terrain_t *terrain;
// for flat animation
INT32 animseq; // start pos. in the anim sequence
INT32 numpics;
INT32 speed;
// for textures
UINT8 *picture;
#ifdef HWRENDER
void *mipmap;
void *mippic;
#endif
UINT8 type;
INT32 texture_id;
};
extern size_t numlevelflats;

View file

@ -217,11 +217,11 @@ void P_InitPicAnims(void)
}
else
{
if ((W_CheckNumForName(animdefs[i].startname)) == LUMPERROR)
if (R_CheckFlatNumForName(animdefs[i].startname) == -1)
continue;
lastanim->picnum = R_GetFlatNumForName(animdefs[i].endname);
lastanim->basepic = R_GetFlatNumForName(animdefs[i].startname);
lastanim->picnum = R_CheckFlatNumForName(animdefs[i].endname);
lastanim->basepic = R_CheckFlatNumForName(animdefs[i].startname);
}
lastanim->istexture = animdefs[i].istexture;
@ -449,82 +449,13 @@ void P_ParseAnimationDefintion(SINT8 istexture)
animdefs[i].speed = animSpeed;
Z_Free(animdefsToken);
#ifdef WALLFLATS
// hehe... uhh.....
// Add it as a texture too
if (!istexture)
{
GrowAnimDefs();
M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t));
animdefs[maxanims-1].istexture = 1;
}
#endif
}
/** Checks for flats in levelflats that are part of a flat animation sequence
* and sets them up for animation.
*
* \param animnum Index into ::anims to find flats for.
* \sa P_SetupLevelFlatAnims
*/
static inline void P_FindAnimatedFlat(INT32 animnum)
{
size_t i;
lumpnum_t startflatnum, endflatnum;
levelflat_t *foundflats;
foundflats = levelflats;
startflatnum = anims[animnum].basepic;
endflatnum = anims[animnum].picnum;
// note: high word of lumpnum is the wad number
if ((startflatnum>>16) != (endflatnum>>16))
I_Error("AnimatedFlat start %s not in same wad as end %s\n",
animdefs[animnum].startname, animdefs[animnum].endname);
//
// now search through the levelflats if this anim flat sequence is used
//
for (i = 0; i < numlevelflats; i++, foundflats++)
{
// is that levelflat from the flat anim sequence ?
if ((anims[animnum].istexture) && (foundflats->type == LEVELFLAT_TEXTURE)
&& ((UINT16)foundflats->u.texture.num >= startflatnum && (UINT16)foundflats->u.texture.num <= endflatnum))
{
foundflats->u.texture.basenum = startflatnum;
foundflats->animseq = foundflats->u.texture.num - startflatnum;
foundflats->numpics = endflatnum - startflatnum + 1;
foundflats->speed = anims[animnum].speed;
CONS_Debug(DBG_SETUP, "animflat: #%03d name:%.8s animseq:%d numpics:%d speed:%d\n",
atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
foundflats->numpics,foundflats->speed);
}
else if ((!anims[animnum].istexture) && (foundflats->type == LEVELFLAT_FLAT)
&& (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum))
{
foundflats->u.flat.baselumpnum = startflatnum;
foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum;
foundflats->numpics = endflatnum - startflatnum + 1;
foundflats->speed = anims[animnum].speed;
CONS_Debug(DBG_SETUP, "animflat: #%03d name:%.8s animseq:%d numpics:%d speed:%d\n",
atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
foundflats->numpics,foundflats->speed);
}
}
}
/** Sets up all flats used in a level.
*
* \sa P_InitPicAnims, P_FindAnimatedFlat
*/
void P_SetupLevelFlatAnims(void)
{
INT32 i;
// the original game flat anim sequences
for (i = 0; anims[i].istexture != -1; i++)
P_FindAnimatedFlat(i);
}
//
@ -6155,13 +6086,6 @@ void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous, boolean
*/
void P_UpdateSpecials(void)
{
anim_t *anim;
INT32 i;
INT32 pic;
size_t j;
levelflat_t *foundflats; // for flat animation
// LEVEL TIMER
P_CheckTimeLimit();
@ -6169,37 +6093,19 @@ void P_UpdateSpecials(void)
P_CheckPointLimit();
// ANIMATE TEXTURES
for (anim = anims; anim < lastanim; anim++)
for (anim_t *anim = anims; anim < lastanim; anim++)
{
for (i = 0; i < anim->numpics; i++)
for (INT32 i = 0; i < anim->numpics; i++)
{
pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
INT32 pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
if (anim->istexture)
texturetranslation[anim->basepic+i] = pic;
}
}
// ANIMATE FLATS
/// \todo do not check the non-animate flat.. link the animated ones?
/// \note its faster than the original anywaysince it animates only
/// flats used in the level, and there's usually very few of them
foundflats = levelflats;
for (j = 0; j < numlevelflats; j++, foundflats++)
{
if (foundflats->speed) // it is an animated flat
{
// update the levelflat texture number
if ((foundflats->type == LEVELFLAT_TEXTURE) && (foundflats->u.texture.basenum != -1))
foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
// update the levelflat lump number
else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR))
foundflats->u.flat.lumpnum = foundflats->u.flat.baselumpnum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
}
}
}
//
// Floor over floors (FOFs), 3Dfloors, 3Dblocks, fake floors (ffloors), rovers, or whatever you want to call them
// 3D floors
//
/** Gets the ID number for a 3Dfloor in its target sector.

View file

@ -526,9 +526,6 @@ void P_StartQuake(fixed_t intensity, tic_t time);
// at game start
void P_InitPicAnims(void);
// at map load (sectors)
void P_SetupLevelFlatAnims(void);
// at map load
void P_InitSpecials(void);
void P_ApplyFlatAlignment(sector_t* sector, angle_t flatangle, fixed_t xoffs, fixed_t yoffs, boolean floor, boolean ceiling);

View file

@ -764,7 +764,7 @@ void *Picture_TextureToFlat(size_t trickytex)
R_CheckTextureCache(tex);
// Allocate the flat
flatsize = (texture->width * texture->height);
flatsize = texture->width * texture->height;
converted = Z_Malloc(flatsize, PU_STATIC, NULL);
memset(converted, TRANSPARENTPIXEL, flatsize);

View file

@ -1118,39 +1118,32 @@ void R_DrawSinglePlane(drawspandata_t *ds, visplane_t *pl, boolean allow_paralle
ds->currentplane = pl;
levelflat = &levelflats[pl->picnum];
/* :james: */
type = levelflat->type;
switch (type)
{
case LEVELFLAT_NONE:
return;
case LEVELFLAT_FLAT:
ds->source = (UINT8 *)R_GetFlat(levelflat->u.flat.lumpnum);
R_CheckFlatLength(ds, W_LumpLength(levelflat->u.flat.lumpnum));
// Raw flats always have dimensions that are powers-of-two numbers.
ds->powersoftwo = true;
break;
default:
ds->source = (UINT8 *)R_GetLevelFlat(ds, levelflat);
if (!ds->source)
return;
// Check if this texture or patch has power-of-two dimensions.
if (R_CheckPowersOfTwo(ds))
R_CheckFlatLength(ds, ds->flatwidth * ds->flatheight);
}
// Get the texture
ds->source = (UINT8 *)R_GetFlat(levelflat);
if (ds->source == NULL)
return;
if (type == LEVELFLAT_TEXTURE)
texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
ds->flatwidth = texture->width;
ds->flatheight = texture->height;
/*(if (R_CheckSolidColorFlat())
ds->solidcolor = true;
else if (R_CheckPowersOfTwo())
{
// Get the span's brightmap.
// FLATS not supported, SORRY!!
INT32 bmNum = R_GetTextureBrightmap(levelflat->u.texture.num);
if (bmNum != 0)
{
// FIXME: This has the potential to read out of
// bounds if the brightmap texture is not as
// large as the flat.
ds->brightmap = (UINT8 *)R_GenerateTextureAsFlat(bmNum);
}
R_SetFlatVars(ds_flatwidth * ds_flatheight);
ds->powersoftwo = true;
}*/
// Get the span's brightmap.
// FLATS not supported, SORRY!!
INT32 bmNum = R_GetTextureBrightmap(levelflat->texture_id);
if (bmNum != 0)
{
// FIXME: This has the potential to read out of
// bounds if the brightmap texture is not as
// large as the flat.
ds->brightmap = (UINT8 *)R_GetFlatForTexture(bmNum);
}
if (!pl->slope // Don't mess with angle on slopes! We'll handle this ourselves later

View file

@ -66,6 +66,7 @@ static struct {
char name[9];
UINT32 hash;
INT32 id;
UINT8 type;
} *tidcache = NULL;
static INT32 tidcachelen = 0;
@ -361,7 +362,8 @@ UINT8 *R_GenerateTexture(size_t texnum)
texture = textures[texnum];
I_Assert(texture != NULL);
// allocate texture column offset lookup
if (texture->type == TEXTURETYPE_FLAT)
goto multipatch;
// single-patch textures can have holes in them and may be used on
// 2sided lines so they need to be kept in 'packed' format
@ -390,11 +392,8 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)pdata;
#ifndef NO_PNG_LUMPS
if (Picture_IsLumpPNG((UINT8 *)realpatch, lumplength))
goto multipatch;
#endif
#ifdef WALLFLATS
if (texture->type == TEXTURETYPE_FLAT)
// TODO: Is it worth converting those?
if (Picture_IsLumpPNG(pdata, lumplength))
goto multipatch;
#endif
@ -495,7 +494,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)Picture_PNGConvert((UINT8 *)realpatch, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
else
#endif
#ifdef WALLFLATS
if (texture->type == TEXTURETYPE_FLAT)
{
if (doremap)
@ -503,7 +501,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_DOOMPATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
}
else
#endif
{
dealloc = false;
if (doremap)
@ -562,29 +559,38 @@ done:
return blocktex;
}
//
// R_GenerateTextureAsFlat
//
// Generates a flat picture for a texture.
//
UINT8 *R_GenerateTextureAsFlat(size_t texnum)
UINT8 *R_GetFlatForTexture(size_t texnum)
{
texture_t *texture = textures[texnum];
UINT8 *converted = NULL;
size_t size = (texture->width * texture->height);
// The flat picture for this texture was not generated yet.
if (!texture->flat)
if (texture->flat != NULL)
return texture->flat;
if (texture->type == TEXTURETYPE_FLAT)
{
// Well, let's do it now, then.
Z_Malloc(size, PU_LEVEL, &texture->flat);
texpatch_t *patch = &texture->patches[0];
UINT16 wadnum = patch->wad;
lumpnum_t lumpnum = patch->lump;
UINT8 *pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
// Picture_TextureToFlat handles everything for us.
converted = (UINT8 *)Picture_TextureToFlat(texnum);
M_Memcpy(texture->flat, converted, size);
Z_Free(converted);
#ifndef NO_PNG_LUMPS
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
if (Picture_IsLumpPNG(pdata, lumplength))
{
texture->flat = Picture_PNGConvert(pdata, PICFMT_FLAT, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
Z_Free(pdata);
}
else
#endif
texture->flat = pdata;
return texture->flat;
}
texture->flat = (UINT8 *)Picture_TextureToFlat(texnum);
flatmemory += texture->width + texture->height;
return texture->flat;
}
@ -935,96 +941,26 @@ UINT8 *R_GetBrightmapColumn(fixed_t tex, INT32 col)
return texturebrightmapcache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
}
void *R_GetFlat(lumpnum_t flatlumpnum)
INT32 R_GetTextureNumForFlat(levelflat_t *levelflat)
{
// FIXME: checking this every time a flat is fetched for drawing is stupid...
// sadly they are not cached anywhere else so i have no choice
boolean doremap = W_NeedPaletteRemap(flatlumpnum, false);
void *flat = W_CacheLumpNum(flatlumpnum, PU_LEVEL);
if (doremap)
R_DoPaletteRemapFlat(flat, W_LumpLength(flatlumpnum));
return flat;
return texturetranslation[levelflat->texture_id];
}
//
// R_GetLevelFlat
//
// If needed, convert a texture or patch to a flat.
//
void *R_GetLevelFlat(drawspandata_t* ds, levelflat_t *levelflat)
void *R_GetFlat(levelflat_t *levelflat)
{
boolean isleveltexture = (levelflat->type == LEVELFLAT_TEXTURE);
texture_t *texture = (isleveltexture ? textures[levelflat->u.texture.num] : NULL);
boolean texturechanged = (isleveltexture ? (levelflat->u.texture.num != levelflat->u.texture.lastnum) : false);
UINT8 *flatdata = NULL;
if (levelflat->type == LEVELFLAT_NONE)
return NULL;
// Check if the texture changed.
if (isleveltexture && (!texturechanged))
{
if (texture->flat)
{
flatdata = texture->flat;
ds->flatwidth = texture->width;
ds->flatheight = texture->height;
texturechanged = false;
}
else
texturechanged = true;
}
// FIXME: checking this every time a flat is fetched for drawing is stupid...
// sadly they are not cached anywhere else so i have no choice
/*boolean doremap = W_NeedPaletteRemap(flatlumpnum, false);
void *flat = W_CacheLumpNum(flatlumpnum, PU_LEVEL);
if (doremap)
R_DoPaletteRemapFlat(flat, W_LumpLength(levelflat->texture_id));
return flat;*/
// If the texture changed, or the flat wasn't generated, convert.
if (levelflat->picture == NULL || texturechanged)
{
// Level texture
if (isleveltexture)
{
levelflat->picture = R_GenerateTextureAsFlat(levelflat->u.texture.num);
ds->flatwidth = levelflat->width = texture->width;
ds->flatheight = levelflat->height = texture->height;
}
else
{
#ifndef NO_PNG_LUMPS
if (levelflat->type == LEVELFLAT_PNG)
{
INT32 pngwidth, pngheight;
levelflat->picture = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_LEVEL), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
levelflat->width = (UINT16)pngwidth;
levelflat->height = (UINT16)pngheight;
ds->flatwidth = levelflat->width;
ds->flatheight = levelflat->height;
}
else
#endif
if (levelflat->type == LEVELFLAT_PATCH)
{
UINT8 *converted;
size_t size;
softwarepatch_t *patch = W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_LEVEL);
levelflat->width = ds->flatwidth = SHORT(patch->width);
levelflat->height = ds->flatheight = SHORT(patch->height);
levelflat->picture = Z_Malloc(levelflat->width * levelflat->height, PU_LEVEL, NULL);
converted = Picture_FlatConvert(PICFMT_DOOMPATCH, patch, PICFMT_FLAT, 0, &size, levelflat->width, levelflat->height, SHORT(patch->topoffset), SHORT(patch->leftoffset), 0);
M_Memcpy(levelflat->picture, converted, size);
Z_Free(converted);
}
}
}
else
{
ds->flatwidth = levelflat->width;
ds->flatheight = levelflat->height;
}
levelflat->u.texture.lastnum = levelflat->u.texture.num;
if (flatdata == NULL)
flatdata = levelflat->picture;
return flatdata;
// FIXME: How do I convert above for new format.
return R_GetFlatForTexture(R_GetTextureNumForFlat(levelflat));
}
//
@ -1178,7 +1114,6 @@ void R_FlushTextureCache(void)
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
#ifdef WALLFLATS
static INT32
Rloadflats (INT32 i, INT32 w)
{
@ -1188,7 +1123,6 @@ Rloadflats (INT32 i, INT32 w)
texpatch_t *patch;
UINT8 header[PNG_HEADER_SIZE];
// Yes
if (wadfiles[w]->type == RET_PK3)
{
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
@ -1207,8 +1141,6 @@ Rloadflats (INT32 i, INT32 w)
{
UINT16 wadnum = (UINT16)w;
lumpnum_t lumpnum = texstart + j;
size_t lumplength;
size_t flatsize = 0;
if (wadfiles[w]->type == RET_PK3)
{
@ -1216,10 +1148,8 @@ Rloadflats (INT32 i, INT32 w)
continue; // If it is then SKIP IT
}
W_ReadLumpHeaderPwad(wadnum, lumpnum, header, sizeof header, 0);
lumplength = W_LumpLengthPwad(wadnum, lumpnum);
flatsize = R_FlatDimensionsFromLumpSize(lumplength);
size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
size_t flatsize = R_FlatDimensionsFromLumpSize(lumplength);
//CONS_Printf("\n\"%s\" is a flat, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),flatsize,flatsize);
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
@ -1229,6 +1159,8 @@ Rloadflats (INT32 i, INT32 w)
texture->hash = quickncasehash(texture->name, 8);
#ifndef NO_PNG_LUMPS
W_ReadLumpHeaderPwad(wadnum, lumpnum, header, sizeof header, 0);
if (Picture_IsLumpPNG(header, lumplength))
{
UINT8 *flatlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
@ -1264,7 +1196,6 @@ Rloadflats (INT32 i, INT32 w)
return i;
}
#endif/*WALLFLATS*/
#define TX_START "TX_START"
#define TX_END "TX_END"
@ -1424,9 +1355,7 @@ static INT32 R_CountTextures(UINT16 wadnum)
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
#ifdef WALLFLATS
count += count_range("F_START", "F_END", "flats/", wadnum);
#endif
// Count the textures from TEXTURES lumps
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, 0);
@ -1508,9 +1437,7 @@ void R_UpdateTextureBrightmap(INT32 tx, INT32 bm)
static INT32 R_DefineTextures(INT32 i, UINT16 w)
{
#ifdef WALLFLATS
i = Rloadflats(i, w);
#endif
return Rloadtextures(i, w);
}
@ -2044,56 +1971,6 @@ static void PaletteTextureHack(const char **name)
}
}
// Search for flat name.
lumpnum_t R_GetFlatNumForName(const char *name)
{
INT32 i;
lumpnum_t lump;
lumpnum_t start;
lumpnum_t end;
PaletteTextureHack(&name);
// Scan wad files backwards so patched flats take preference.
for (i = numwadfiles - 1; i >= 0; i--)
{
switch (wadfiles[i]->type)
{
case RET_WAD:
if ((start = W_CheckNumForMarkerStartPwad("F_START", (UINT16)i, 0)) == INT16_MAX)
{
if ((start = W_CheckNumForMarkerStartPwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
continue;
else if ((end = W_CheckNumForNamePwad("FF_END", (UINT16)i, start)) == INT16_MAX)
continue;
}
else
if ((end = W_CheckNumForNamePwad("F_END", (UINT16)i, start)) == INT16_MAX)
continue;
break;
case RET_PK3:
if ((start = W_CheckNumForFolderStartPK3("Flats/", i, 0)) == INT16_MAX)
continue;
if ((end = W_CheckNumForFolderEndPK3("Flats/", i, start)) == INT16_MAX)
continue;
break;
default:
continue;
}
// Now find lump with specified name in that range.
lump = W_CheckNumForNamePwad(name, (UINT16)i, start);
if (lump < end)
{
lump += (i<<16); // found it, in our constraints
break;
}
lump = LUMPERROR;
}
return lump;
}
void R_ClearTextureNumCache(boolean btell)
{
if (tidcache)
@ -2104,6 +1981,20 @@ void R_ClearTextureNumCache(boolean btell)
tidcachelen = 0;
}
static void AddTextureToCache(const char *name, UINT32 hash, INT32 id, UINT8 type)
{
tidcachelen++;
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
strncpy(tidcache[tidcachelen-1].name, name, 8);
tidcache[tidcachelen-1].name[8] = '\0';
#ifndef ZDEBUG
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
#endif
tidcache[tidcachelen-1].hash = hash;
tidcache[tidcachelen-1].id = id;
tidcache[tidcachelen-1].type = type;
}
//
// R_CheckTextureNumForName
//
@ -2126,18 +2017,10 @@ INT32 R_CheckTextureNumForName(const char *name)
if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
return tidcache[i].id;
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
//for (i = 0; i < numtextures; i++) <- old
for (i = (numtextures - 1); i >= 0; i--) // <- new
for (i = numtextures - 1; i >= 0; i--)
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
{
tidcachelen++;
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
strncpy(tidcache[tidcachelen-1].name, name, 8);
tidcache[tidcachelen-1].name[8] = '\0';
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
tidcache[tidcachelen-1].hash = hash;
tidcache[tidcachelen-1].id = i;
AddTextureToCache(name, hash, i, textures[i]->type);
return i;
}
@ -2170,3 +2053,28 @@ INT32 R_TextureNumForName(const char *name)
}
return i;
}
INT32 R_CheckFlatNumForName(const char *name)
{
INT32 i;
UINT32 hash;
// "NoTexture" marker.
if (name[0] == '-')
return 0;
hash = quickncasehash(name, 8);
for (i = 0; i < tidcachelen; i++)
if (tidcache[i].type == TEXTURETYPE_FLAT && tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
return tidcache[i].id;
for (i = numtextures - 1; i >= 0; i--)
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8) && textures[i]->type == TEXTURETYPE_FLAT)
{
AddTextureToCache(name, hash, i, TEXTURETYPE_FLAT);
return i;
}
return -1;
}

View file

@ -44,9 +44,7 @@ enum
TEXTURETYPE_UNKNOWN,
TEXTURETYPE_SINGLEPATCH,
TEXTURETYPE_COMPOSITE,
#ifdef WALLFLATS
TEXTURETYPE_FLAT,
#endif
};
// A texture_t describes a rectangular texture,
@ -86,7 +84,7 @@ void R_FlushTextureCache(void);
// Texture generation
UINT8 *R_GenerateTexture(size_t texnum);
UINT8 *R_GenerateTextureAsFlat(size_t texnum);
UINT8 *R_GetFlatForTexture(size_t texnum);
UINT8 *R_GenerateTextureBrightmap(size_t texnum);
INT32 R_GetTextureNum(INT32 texnum);
INT32 R_GetTextureBrightmap(INT32 texnum);
@ -98,10 +96,11 @@ void R_DoPaletteRemapPatch(softwarepatch_t *patch, size_t size);
void R_DoPaletteRemapFlat(UINT8 *data, size_t size);
// Retrieve texture data.
void *R_GetLevelFlat(drawspandata_t* ds, levelflat_t *levelflat);
UINT8 *R_GetColumn(fixed_t tex, INT32 col);
UINT8 *R_GetBrightmapColumn(fixed_t tex, INT32 col);
void *R_GetFlat(lumpnum_t flatnum);
void *R_GetFlat(levelflat_t *levelflat);
INT32 R_GetTextureNumForFlat(levelflat_t *levelflat);
boolean R_CheckPowersOfTwo(drawspandata_t* ds);
void R_CheckFlatLength(drawspandata_t* ds, size_t size);
@ -111,7 +110,7 @@ void R_UpdateTextureBrightmap(INT32 tx, INT32 bm);
// Returns the texture number for the texture name.
INT32 R_TextureNumForName(const char *name);
INT32 R_CheckTextureNumForName(const char *name);
lumpnum_t R_GetFlatNumForName(const char *name);
INT32 R_CheckFlatNumForName(const char *name);
extern INT32 numtextures;