mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-07 16:42:45 +00:00
Add BrightMap support to SPRTINFO
This commit is contained in:
parent
da8809c911
commit
9c8d6dfaa6
4 changed files with 46 additions and 7 deletions
|
|
@ -1474,9 +1474,10 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
|
|||
size_t sprinfoTokenLength;
|
||||
char *frameChar = NULL;
|
||||
UINT8 frameFrame = 0xFF;
|
||||
INT16 frameXPivot = 0;
|
||||
INT16 frameYPivot = 0;
|
||||
INT16 frameXPivot = INT16_MIN;
|
||||
INT16 frameYPivot = INT16_MIN;
|
||||
rotaxis_t frameRotAxis = 0;
|
||||
char *bright = NULL;
|
||||
|
||||
if (all)
|
||||
{
|
||||
|
|
@ -1541,6 +1542,11 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
|
|||
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0) || (stricmp(sprinfoToken, "YAW")==0))
|
||||
frameRotAxis = ROTAXIS_Z;
|
||||
}
|
||||
else if (stricmp(sprinfoToken, "BRIGHTMAP")==0)
|
||||
{
|
||||
Z_Free(bright);
|
||||
bright = M_GetToken(NULL);
|
||||
}
|
||||
Z_Free(sprinfoToken);
|
||||
|
||||
sprinfoToken = M_GetToken(NULL);
|
||||
|
|
@ -1557,8 +1563,13 @@ static void R_ParseSpriteInfoFrame(struct ParseSpriteInfoState *parser, boolean
|
|||
parser->info->pivot[frameFrame].x = frameXPivot;
|
||||
parser->info->pivot[frameFrame].y = frameYPivot;
|
||||
parser->info->pivot[frameFrame].rotaxis = frameRotAxis;
|
||||
Z_Free(parser->info->bright[frameFrame]);
|
||||
parser->info->bright[frameFrame] = bright;
|
||||
|
||||
set_bit_array(parser->info->available, frameFrame);
|
||||
if (frameXPivot != INT16_MIN || frameYPivot != INT16_MIN)
|
||||
{
|
||||
set_bit_array(parser->info->available, frameFrame);
|
||||
}
|
||||
|
||||
if (parser->spr2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ struct spriteinfo_t
|
|||
spriteframepivot_t pivot[64 + 1];
|
||||
#define SPRINFO_DEFAULT_PIVOT (64)
|
||||
UINT8 available[BIT_ARRAY_SIZE(64 + 1)]; // 1 extra for default_pivot
|
||||
char *bright[64 + 1]; // brightmap lump name
|
||||
};
|
||||
|
||||
// Portable Network Graphics
|
||||
|
|
|
|||
|
|
@ -862,12 +862,13 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
|
|||
//
|
||||
static void R_DrawVisSprite(vissprite_t *vis)
|
||||
{
|
||||
column_t *column;
|
||||
column_t *column, *bmcol = NULL;
|
||||
void (*localcolfunc)(column_t *, column_t *, INT32);
|
||||
INT32 texturecolumn;
|
||||
INT32 pwidth;
|
||||
fixed_t frac;
|
||||
patch_t *patch = vis->patch;
|
||||
patch_t *bmpatch = vis->bright;
|
||||
fixed_t this_scale = vis->thingscale;
|
||||
INT32 x1, x2;
|
||||
INT64 overflow_test;
|
||||
|
|
@ -1022,7 +1023,10 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
|
||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||
|
||||
localcolfunc (column, NULL, baseclip);
|
||||
if (bmpatch)
|
||||
bmcol = (column_t *)((UINT8 *)bmpatch->columns + (bmpatch->columnofs[texturecolumn]));
|
||||
|
||||
localcolfunc (column, bmcol, baseclip);
|
||||
}
|
||||
}
|
||||
else if (vis->cut & SC_SHEAR)
|
||||
|
|
@ -1041,9 +1045,11 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
||||
#endif
|
||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||
if (bmpatch)
|
||||
bmcol = (column_t *)((UINT8 *)bmpatch->columns + (bmpatch->columnofs[texturecolumn]));
|
||||
|
||||
sprtopscreen = (centeryfrac - FixedMul(dc_texturemid, spryscale));
|
||||
localcolfunc (column, NULL, baseclip);
|
||||
localcolfunc (column, bmcol, baseclip);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1062,7 +1068,11 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
|||
I_Error("R_DrawSpriteRange: bad texturecolumn at %d from end", vis->x2 - dc_x);
|
||||
#endif
|
||||
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
|
||||
localcolfunc (column, NULL, baseclip);
|
||||
|
||||
if (bmpatch)
|
||||
bmcol = (column_t *)((UINT8 *)bmpatch->columns + (bmpatch->columnofs[texturecolumn]));
|
||||
|
||||
localcolfunc (column, bmcol, baseclip);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1219,6 +1229,18 @@ static void R_SplitSprite(vissprite_t *sprite)
|
|||
}
|
||||
}
|
||||
|
||||
static patch_t *R_CacheSpriteBrightMap(const spriteinfo_t *sprinfo, UINT8 frame)
|
||||
{
|
||||
const char *name = sprinfo->bright[frame];
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
name = sprinfo->bright[SPRINFO_DEFAULT_PIVOT];
|
||||
}
|
||||
|
||||
return W_CachePatchNum(W_CheckNumForLongName(name), PU_SPRITE);
|
||||
}
|
||||
|
||||
//
|
||||
// R_GetShadowZ(thing, shadowslope)
|
||||
// Get the first visible floor below the object for shadows
|
||||
|
|
@ -1395,6 +1417,7 @@ static void R_ProjectDropShadow(
|
|||
|
||||
shadow = R_NewVisSprite();
|
||||
shadow->patch = patch;
|
||||
shadow->bright = NULL;
|
||||
shadow->heightsec = vis->heightsec;
|
||||
|
||||
shadow->mobjflags = 0;
|
||||
|
|
@ -2320,6 +2343,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
vis->cut |= SC_SPLAT; // I like ya cut g
|
||||
|
||||
vis->patch = patch;
|
||||
vis->bright = R_CacheSpriteBrightMap(sprinfo, frame);
|
||||
|
||||
if (thing->subsector->sector->numlights && !(shadowdraw || splat))
|
||||
R_SplitSprite(vis);
|
||||
|
|
@ -2503,6 +2527,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
vis->patch = W_CachePatchNum(sprframe->lumppat[0], PU_SPRITE);
|
||||
vis->bright = R_CacheSpriteBrightMap(&spriteinfo[thing->sprite],
|
||||
thing->frame & FF_FRAMEMASK);
|
||||
|
||||
vis->transmap = R_GetBlendTable(blendmode, trans);
|
||||
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ struct vissprite_t
|
|||
|
||||
fixed_t texturemid;
|
||||
patch_t *patch;
|
||||
patch_t *bright;
|
||||
|
||||
lighttable_t *colormap; // for color translation and shadow draw
|
||||
// maxbright frames as well
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue