precache animated textures too
This commit is contained in:
1 parent
a403d96204
commit
29b93f63f7
3 files changed
+50
-15
No files matched your search
@@ -30,6 +30,7 @@
|
||||
#include "../r_main.h"
|
||||
#include "../r_patch.h" // patch rotation
|
||||
#include "../p_setup.h" // levelflats
|
||||
#include "../p_spec.h" // anim_t
|
||||
#include "../r_sky.h"
|
||||
|
||||
INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
|
||||
@@ -610,6 +611,8 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
{
|
||||
char *texturepresent;
|
||||
size_t i, j;
|
||||
INT32 h;
|
||||
anim_t *anim;
|
||||
|
||||
texturepresent = calloc(numtextures, sizeof (*texturepresent));
|
||||
if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "HWR_PrecacheLevel");
|
||||
@@ -646,6 +649,31 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
}
|
||||
}
|
||||
|
||||
for (anim = anims; anim < lastanim; anim++)
|
||||
{
|
||||
if (!anim->istexture)
|
||||
continue;
|
||||
|
||||
if (!texturepresent[anim->basepic])
|
||||
continue;
|
||||
|
||||
if (texturepresent[anim->basepic] & 1)
|
||||
{
|
||||
for (h = 0; h < anim->numpics; h++)
|
||||
{
|
||||
HWR_GetTexture(anim->basepic+h, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (texturepresent[anim->basepic] & 2)
|
||||
{
|
||||
for (h = 0; h < anim->numpics; h++)
|
||||
{
|
||||
HWR_GetTexture(anim->basepic+h, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sky texture is always present.
|
||||
// Note that F_SKY1 is the name used to indicate a sky floor/ceiling as a flat,
|
||||
// while the sky texture is stored like a wall texture, with a skynum dependent name.
|
||||
@@ -657,10 +685,14 @@ static void HWR_PrecacheLevelTextures(void)
|
||||
continue;
|
||||
|
||||
if (texturepresent[i] & 1)
|
||||
{
|
||||
HWR_GetTexture(i, false);
|
||||
}
|
||||
|
||||
if (texturepresent[i] & 2)
|
||||
{
|
||||
HWR_GetTexture(i, true);
|
||||
}
|
||||
}
|
||||
free(texturepresent);
|
||||
}
|
||||
|
||||
+2
-15
@@ -51,19 +51,6 @@ mobj_t *skyboxmo[2];
|
||||
// This must be updated whenever we up the max flat size - quicker to assume rather than figuring out the sqrt of the specific flat's filesize.
|
||||
#define MAXFLATSIZE (2048<<FRACBITS)
|
||||
|
||||
/** Animated texture descriptor
|
||||
* This keeps track of an animated texture or an animated flat.
|
||||
* \sa P_UpdateSpecials, P_InitPicAnims, animdef_t
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SINT8 istexture; ///< ::true for a texture, ::false for a flat
|
||||
INT32 picnum; ///< The end flat number
|
||||
INT32 basepic; ///< The start flat number
|
||||
INT32 numpics; ///< Number of frames in the animation
|
||||
tic_t speed; ///< Number of tics for which each frame is shown
|
||||
} anim_t;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
@@ -113,8 +100,8 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer);
|
||||
|
||||
|
||||
//SoM: 3/7/2000: New sturcture without limits.
|
||||
static anim_t *lastanim;
|
||||
static anim_t *anims = NULL; /// \todo free leak
|
||||
anim_t *lastanim;
|
||||
anim_t *anims = NULL; /// \todo free leak
|
||||
static size_t maxanims;
|
||||
|
||||
//
|
||||
|
||||
@@ -25,6 +25,22 @@ extern mobj_t *skyboxmo[2];
|
||||
//
|
||||
#define GETSECSPECIAL(i,j) ((i >> ((j-1)*4))&15)
|
||||
|
||||
/** Animated texture descriptor
|
||||
* This keeps track of an animated texture or an animated flat.
|
||||
* \sa P_UpdateSpecials, P_InitPicAnims, animdef_t
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SINT8 istexture; ///< ::true for a texture, ::false for a flat
|
||||
INT32 picnum; ///< The end flat number
|
||||
INT32 basepic; ///< The start flat number
|
||||
INT32 numpics; ///< Number of frames in the animation
|
||||
tic_t speed; ///< Number of tics for which each frame is shown
|
||||
} anim_t;
|
||||
|
||||
extern anim_t *lastanim;
|
||||
extern anim_t *anims;
|
||||
|
||||
// at game start
|
||||
void P_InitPicAnims(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user