mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 19:02:45 +00:00
Clean out code/update comments relating to TEXTUREn, TEXTURE (SOC), PNAMES, and ANIMATED.
This commit is contained in:
parent
a61be91523
commit
a3767fedac
5 changed files with 31 additions and 85 deletions
|
@ -3082,7 +3082,6 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
|||
INT16 firstmapreplaced = 0, num;
|
||||
char *name;
|
||||
lumpinfo_t *lumpinfo;
|
||||
boolean texturechange = false;
|
||||
boolean replacedcurrentmap = false;
|
||||
|
||||
if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX)
|
||||
|
@ -3126,14 +3125,6 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
|||
CONS_Debug(DBG_SETUP, "Music %.8s replaced\n", name);
|
||||
digmreplaces++;
|
||||
}
|
||||
#if 0
|
||||
//
|
||||
// search for texturechange replacements
|
||||
//
|
||||
else if (!memcmp(name, "TEXTURE1", 8) || !memcmp(name, "TEXTURE2", 8)
|
||||
|| !memcmp(name, "PNAMES", 6))
|
||||
#endif
|
||||
texturechange = true;
|
||||
}
|
||||
if (!devparm && sreplaces)
|
||||
CONS_Printf(M_GetText("%s sounds replaced\n"), sizeu1(sreplaces));
|
||||
|
@ -3149,13 +3140,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
|||
|
||||
// Reload it all anyway, just in case they
|
||||
// added some textures but didn't insert a
|
||||
// TEXTURE1/PNAMES/etc. list.
|
||||
if (texturechange) // initialized in the sound check
|
||||
R_LoadTextures(); // numtexture changes
|
||||
else
|
||||
R_FlushTextureCache(); // just reload it from file
|
||||
// TEXTURES/etc. list.
|
||||
R_LoadTextures(); // numtexture changes
|
||||
|
||||
// Reload ANIMATED / ANIMDEFS
|
||||
// Reload ANIMDEFS
|
||||
P_InitPicAnims();
|
||||
|
||||
// Flush and reload HUD graphics
|
||||
|
|
41
src/p_spec.c
41
src/p_spec.c
|
@ -74,7 +74,7 @@ typedef struct
|
|||
#endif
|
||||
|
||||
/** Animated texture definition.
|
||||
* Used for ::harddefs and for loading an ANIMATED lump from a wad.
|
||||
* Used for ::harddefs and for loading an ANIMDEFS lump from a wad.
|
||||
*
|
||||
* Animations are defined by the first and last frame (i.e., flat or texture).
|
||||
* The animation sequence uses all flats between the start and end entry, in
|
||||
|
@ -125,7 +125,7 @@ static size_t maxanims;
|
|||
// P_InitPicAnims
|
||||
//
|
||||
/** Hardcoded animation sequences.
|
||||
* Used if no ANIMATED lump is found in a loaded wad.
|
||||
* Used if no ANIMDEFS lump is found in a loaded wad.
|
||||
*/
|
||||
static animdef_t harddefs[] =
|
||||
{
|
||||
|
@ -244,48 +244,17 @@ void P_InitPicAnims(void)
|
|||
{
|
||||
// Init animation
|
||||
INT32 w; // WAD
|
||||
UINT8 *animatedLump;
|
||||
UINT8 *currentPos;
|
||||
size_t i;
|
||||
|
||||
I_Assert(animdefs == NULL);
|
||||
|
||||
if (W_CheckNumForName("ANIMATED") != LUMPERROR || W_CheckNumForName("ANIMDEFS") != LUMPERROR)
|
||||
if (W_CheckNumForName("ANIMDEFS") != LUMPERROR)
|
||||
{
|
||||
for (w = numwadfiles-1, maxanims = 0; w >= 0; w--)
|
||||
{
|
||||
UINT16 animatedLumpNum;
|
||||
UINT16 animdefsLumpNum;
|
||||
|
||||
// Find ANIMATED lump in the WAD
|
||||
animatedLumpNum = W_CheckNumForNamePwad("ANIMATED", w, 0);
|
||||
if (animatedLumpNum != INT16_MAX)
|
||||
{
|
||||
animatedLump = (UINT8 *)W_CacheLumpNumPwad(w, animatedLumpNum, PU_STATIC);
|
||||
|
||||
// Get the number of animations in the file
|
||||
i = maxanims;
|
||||
for (currentPos = animatedLump; *currentPos != UINT8_MAX; maxanims++, currentPos+=23);
|
||||
|
||||
// Resize animdefs (or if it hasn't been created, create it)
|
||||
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
||||
// Sanity check it
|
||||
if (!animdefs)
|
||||
I_Error("Not enough free memory for ANIMATED data");
|
||||
|
||||
// Populate the new array
|
||||
for (currentPos = animatedLump; *currentPos != UINT8_MAX; i++, currentPos+=23)
|
||||
{
|
||||
M_Memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
|
||||
M_Memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
|
||||
M_Memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
|
||||
M_Memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
|
||||
}
|
||||
|
||||
Z_Free(animatedLump);
|
||||
}
|
||||
|
||||
// Now find ANIMDEFS
|
||||
// Find ANIMDEFS lump in the WAD
|
||||
animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
|
||||
if (animdefsLumpNum != INT16_MAX)
|
||||
P_ParseANIMDEFSLump(w, animdefsLumpNum);
|
||||
|
@ -307,7 +276,7 @@ void P_InitPicAnims(void)
|
|||
|
||||
anims = (anim_t *)malloc(sizeof (*anims)*(maxanims + 1));
|
||||
if (!anims)
|
||||
I_Error("Not enough free memory for ANIMATED data");
|
||||
I_Error("Not enough free memory for ANIMDEFS data");
|
||||
|
||||
lastanim = anims;
|
||||
for (i = 0; animdefs[i].istexture != -1; i++)
|
||||
|
|
53
src/r_data.c
53
src/r_data.c
|
@ -625,44 +625,33 @@ void R_LoadTextures(void)
|
|||
{
|
||||
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
||||
|
||||
// Then, check the lump directly to see if it's a texture SOC,
|
||||
// and if it is, load it using dehacked instead.
|
||||
if (strstr((const char *)patchlump, "TEXTURE"))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "%s is a Texture SOC.\n", W_CheckNameForNumPwad((UINT16)w,texstart+j));
|
||||
Z_Unlock(patchlump);
|
||||
DEH_LoadDehackedLumpPwad((UINT16)w, texstart + j);
|
||||
}
|
||||
else
|
||||
{
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
texture->flip = 0;
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
texture->flip = 0;
|
||||
|
||||
// Allocate information for the texture's patches.
|
||||
patch = &texture->patches[0];
|
||||
// Allocate information for the texture's patches.
|
||||
patch = &texture->patches[0];
|
||||
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
patch->flip = 0;
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
patch->flip = 0;
|
||||
|
||||
Z_Unlock(patchlump);
|
||||
Z_Unlock(patchlump);
|
||||
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
}
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ extern INT16 *hicolormaps; // remap high colors to high colors..
|
|||
|
||||
extern CV_PossibleValue_t Color_cons_t[];
|
||||
|
||||
// Load TEXTURE1/TEXTURE2/PNAMES definitions, create lookup tables
|
||||
// Load TEXTURES definitions, create lookup tables
|
||||
void R_LoadTextures(void);
|
||||
void R_FlushTextureCache(void);
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ typedef enum
|
|||
// Patches.
|
||||
// A patch holds one or more columns.
|
||||
// Patches are used for sprites and all masked pictures, and we compose
|
||||
// textures from the TEXTURE1 list of patches.
|
||||
// textures from the TEXTURES list of patches.
|
||||
//
|
||||
// WARNING: this structure is cloned in GLPatch_t
|
||||
typedef struct
|
||||
|
|
Loading…
Reference in a new issue