mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Support for additive/subtractive translation maps on FOFs and Polyobjects
Polyobjects set translucency to 11 for additive, and 12 for subtractive FOFs using the regular translucency settings set the top texture to #900 for additive, and #901 for subtractive
This commit is contained in:
parent
4a10861669
commit
d311242a6e
5 changed files with 53 additions and 12 deletions
|
|
@ -1735,10 +1735,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
{
|
{
|
||||||
FBITFIELD blendmode = PF_Masked;
|
FBITFIELD blendmode = PF_Masked;
|
||||||
|
|
||||||
if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
if (rover->flags & FF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
blendmode = PF_Translucent;
|
if (rover->alpha < 256)
|
||||||
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
{
|
||||||
|
blendmode = PF_Translucent;
|
||||||
|
Surf.PolyColor.s.alpha = (UINT8)(rover->alpha-1 > 255 ? 255 : rover->alpha-1);
|
||||||
|
}
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
blendmode = PF_Additive;
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
blendmode = PF_Substractive;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_frontsector->numlights)
|
if (gl_frontsector->numlights)
|
||||||
|
|
@ -1835,10 +1842,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
{
|
{
|
||||||
FBITFIELD blendmode = PF_Masked;
|
FBITFIELD blendmode = PF_Masked;
|
||||||
|
|
||||||
if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
if (rover->flags & FF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
blendmode = PF_Translucent;
|
if (rover->alpha < 256)
|
||||||
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
{
|
||||||
|
blendmode = PF_Translucent;
|
||||||
|
Surf.PolyColor.s.alpha = (UINT8)(rover->alpha-1 > 255 ? 255 : rover->alpha-1);
|
||||||
|
}
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
blendmode = PF_Additive;
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
blendmode = PF_Substractive;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_backsector->numlights)
|
if (gl_backsector->numlights)
|
||||||
|
|
@ -3098,8 +3112,16 @@ static void HWR_Subsector(size_t num)
|
||||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||||
true, rover->master->frontsector->extra_colormap);
|
true, rover->master->frontsector->extra_colormap);
|
||||||
}
|
}
|
||||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient
|
else if (rover->flags & FF_TRANSLUCENT
|
||||||
|
&& (rover->alpha < 256
|
||||||
|
|| rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE || rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)) // SoM: Flags are more efficient
|
||||||
{
|
{
|
||||||
|
FBITFIELD blendmode = PF_Translucent;
|
||||||
|
if (rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
blendmode = PF_Additive;
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
blendmode = PF_Substractive;
|
||||||
|
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
|
|
||||||
HWR_AddTransparentFloor(&levelflats[*rover->bottompic],
|
HWR_AddTransparentFloor(&levelflats[*rover->bottompic],
|
||||||
|
|
@ -3107,7 +3129,7 @@ static void HWR_Subsector(size_t num)
|
||||||
false,
|
false,
|
||||||
*rover->bottomheight,
|
*rover->bottomheight,
|
||||||
*gl_frontsector->lightlist[light].lightlevel,
|
*gl_frontsector->lightlist[light].lightlevel,
|
||||||
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|blendmode,
|
||||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3143,8 +3165,16 @@ static void HWR_Subsector(size_t num)
|
||||||
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
alpha, rover->master->frontsector, PF_Fog|PF_NoTexture,
|
||||||
true, rover->master->frontsector->extra_colormap);
|
true, rover->master->frontsector->extra_colormap);
|
||||||
}
|
}
|
||||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
else if (rover->flags & FF_TRANSLUCENT
|
||||||
|
&& (rover->alpha < 256
|
||||||
|
|| rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE || rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)) // SoM: Flags are more efficient
|
||||||
{
|
{
|
||||||
|
FBITFIELD blendmode = PF_Translucent;
|
||||||
|
if (rover->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
blendmode = PF_Additive;
|
||||||
|
else if (rover->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
blendmode = PF_Substractive;
|
||||||
|
|
||||||
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
light = R_GetPlaneLight(gl_frontsector, centerHeight, dup_viewz < cullHeight ? true : false);
|
||||||
|
|
||||||
HWR_AddTransparentFloor(&levelflats[*rover->toppic],
|
HWR_AddTransparentFloor(&levelflats[*rover->toppic],
|
||||||
|
|
@ -3152,7 +3182,7 @@ static void HWR_Subsector(size_t num)
|
||||||
true,
|
true,
|
||||||
*rover->topheight,
|
*rover->topheight,
|
||||||
*gl_frontsector->lightlist[light].lightlevel,
|
*gl_frontsector->lightlist[light].lightlevel,
|
||||||
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Translucent,
|
rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|blendmode,
|
||||||
false, *gl_frontsector->lightlist[light].extra_colormap);
|
false, *gl_frontsector->lightlist[light].extra_colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2563,7 +2563,7 @@ void T_PolyObjFade(polyfade_t *th)
|
||||||
{
|
{
|
||||||
if (po->translucency >= NUMTRANSMAPS)
|
if (po->translucency >= NUMTRANSMAPS)
|
||||||
// HACK: OpenGL renders fully opaque when >= NUMTRANSMAPS
|
// HACK: OpenGL renders fully opaque when >= NUMTRANSMAPS
|
||||||
po->translucency = NUMTRANSMAPS-1;
|
po->translucency = tr_trans90;
|
||||||
|
|
||||||
po->flags |= (po->spawnflags & POF_RENDERALL);
|
po->flags |= (po->spawnflags & POF_RENDERALL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,9 @@ typedef enum
|
||||||
FF_GOOWATER = FF_SHATTERBOTTOM, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
FF_GOOWATER = FF_SHATTERBOTTOM, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
||||||
} ffloortype_e;
|
} ffloortype_e;
|
||||||
|
|
||||||
|
#define FFLOOR_ALPHA_SPECIAL_ADDITIVE (901)
|
||||||
|
#define FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE (902)
|
||||||
|
|
||||||
typedef struct ffloor_s
|
typedef struct ffloor_s
|
||||||
{
|
{
|
||||||
fixed_t *topheight;
|
fixed_t *topheight;
|
||||||
|
|
|
||||||
|
|
@ -952,7 +952,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
if (pl->polyobj)
|
if (pl->polyobj)
|
||||||
{
|
{
|
||||||
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
|
||||||
if (pl->polyobj->translucency >= 10)
|
if (pl->polyobj->translucency >= NUMTRANSMAPS)
|
||||||
return; // Don't even draw it
|
return; // Don't even draw it
|
||||||
else if (pl->polyobj->translucency > 0)
|
else if (pl->polyobj->translucency > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1013,6 +1013,10 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
ds_transmap = transtables + ((tr_trans20-1)<<FF_TRANSSHIFT);
|
ds_transmap = transtables + ((tr_trans20-1)<<FF_TRANSSHIFT);
|
||||||
else if (pl->ffloor->alpha < 243)
|
else if (pl->ffloor->alpha < 243)
|
||||||
ds_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
ds_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
||||||
|
else if (pl->ffloor->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
dc_transmap = transtables + ((tr_transadd-1)<<FF_TRANSSHIFT);
|
||||||
|
else if (pl->ffloor->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
dc_transmap = transtables + ((tr_transsub-1)<<FF_TRANSSHIFT);
|
||||||
else // Opaque, but allow transparent flat pixels
|
else // Opaque, but allow transparent flat pixels
|
||||||
spanfunctype = SPANDRAWFUNC_SPLAT;
|
spanfunctype = SPANDRAWFUNC_SPLAT;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -775,6 +775,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
dc_transmap = transtables + ((tr_trans20-1)<<FF_TRANSSHIFT);
|
dc_transmap = transtables + ((tr_trans20-1)<<FF_TRANSSHIFT);
|
||||||
else if (pfloor->alpha < 243)
|
else if (pfloor->alpha < 243)
|
||||||
dc_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
dc_transmap = transtables + ((tr_trans10-1)<<FF_TRANSSHIFT);
|
||||||
|
else if (pfloor->alpha == FFLOOR_ALPHA_SPECIAL_ADDITIVE)
|
||||||
|
dc_transmap = transtables + ((tr_transadd-1)<<FF_TRANSSHIFT);
|
||||||
|
else if (pfloor->alpha == FFLOOR_ALPHA_SPECIAL_SUBTRACTIVE)
|
||||||
|
dc_transmap = transtables + ((tr_transsub-1)<<FF_TRANSSHIFT);
|
||||||
else
|
else
|
||||||
fuzzy = false; // Opaque
|
fuzzy = false; // Opaque
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue