mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Add rudimentary and non-working code for translucency on patches.
This commit is contained in:
parent
cfb5a9d904
commit
bb49362577
2 changed files with 51 additions and 1 deletions
47
src/r_data.c
47
src/r_data.c
|
@ -211,6 +211,41 @@ static inline void R_DrawFlippedColumnInCache(column_t *patch, UINT8 *cache, INT
|
|||
patch = (column_t *)((UINT8 *)patch + patch->length + 4);
|
||||
}
|
||||
}
|
||||
R_DrawTranslucentColumn_8()
|
||||
static inline void R_DrawTransColumnInCache(column_t *patch, UINT8 *cache, INT32 originy, INT32 cacheheight)
|
||||
{
|
||||
INT32 count, position;
|
||||
UINT8 *source;
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
|
||||
while (patch->topdelta != 0xff)
|
||||
{
|
||||
topdelta = patch->topdelta;
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
source = (UINT8 *)patch + 3;
|
||||
count = patch->length;
|
||||
position = originy + topdelta;
|
||||
|
||||
if (position < 0)
|
||||
{
|
||||
count += position;
|
||||
source -= position; // start further down the column
|
||||
position = 0;
|
||||
}
|
||||
|
||||
if (position + count > cacheheight)
|
||||
count = cacheheight - position;
|
||||
|
||||
if (count > 0)
|
||||
M_Memcpy(cache + position, source, count);
|
||||
|
||||
patch = (column_t *)((UINT8 *)patch + patch->length + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// R_GenerateTexture
|
||||
|
@ -588,6 +623,8 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
|||
INT16 patchXPos;
|
||||
INT16 patchYPos;
|
||||
UINT8 flip = 0;
|
||||
UINT8 alpha = 255;
|
||||
enum patchalphastyle style = AST_COPY;
|
||||
texpatch_t *resultPatch = NULL;
|
||||
lumpnum_t patchLumpNum;
|
||||
|
||||
|
@ -703,7 +740,13 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
|||
}
|
||||
while (strcmp(texturesToken,"}")!=0)
|
||||
{
|
||||
if (stricmp(texturesToken, "FLIPX")==0)
|
||||
if (stricmp(texturesToken, "ALPHA")==0)
|
||||
{
|
||||
Z_Free(texturesToken);
|
||||
texturesToken = M_GetToken(NULL);
|
||||
alpha = 255*strtof(texturesToken, NULL);
|
||||
}
|
||||
else if (stricmp(texturesToken, "FLIPX")==0)
|
||||
flip |= 1;
|
||||
else if (stricmp(texturesToken, "FLIPY")==0)
|
||||
flip |= 2;
|
||||
|
@ -736,6 +779,8 @@ static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
|||
resultPatch->lump = patchLumpNum & 65535;
|
||||
resultPatch->wad = patchLumpNum>>16;
|
||||
resultPatch->flip = flip;
|
||||
resultPatch->alpha = alpha;
|
||||
resultPatch->style = style;
|
||||
// Clean up a little after ourselves
|
||||
Z_Free(patchName);
|
||||
// Then return it
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Possible alpha types for a patch.
|
||||
enum patchalphastyle {AST_COPY, AST_TRANSLUCENT}; // , AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY};
|
||||
|
||||
// moved here for r_sky.c (texpatch_t is used)
|
||||
|
||||
// A single patch from a texture definition,
|
||||
|
@ -32,6 +35,8 @@ typedef struct
|
|||
INT16 originx, originy;
|
||||
UINT16 wad, lump;
|
||||
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
||||
UINT8 alpha; // Translucency value
|
||||
enum patchalphastyle style;
|
||||
} texpatch_t;
|
||||
|
||||
// A maptexturedef_t describes a rectangular texture,
|
||||
|
|
Loading…
Reference in a new issue