Prelim: Linedef alpha variable

realistically this was just because I'm Lazy
this makes figuring out linedef blending less of a brain twister
This commit is contained in:
Chearii committed 2025-02-02 21:14:48 -05:00
1 parent 36a1662afb
commit cd44e2d80c
6 files changed
+60 -49

No files matched your search

+4 -28
View File
@@ -1208,33 +1208,6 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
// set alpha for transparent walls
switch (gl_linedef->special)
{
case 900:
blendmode = HWR_TranstableToAlpha(tr_trans10, pSurf);
break;
case 901:
blendmode = HWR_TranstableToAlpha(tr_trans20, pSurf);
break;
case 902:
blendmode = HWR_TranstableToAlpha(tr_trans30, pSurf);
break;
case 903:
blendmode = HWR_TranstableToAlpha(tr_trans40, pSurf);
break;
case 904:
blendmode = HWR_TranstableToAlpha(tr_trans50, pSurf);
break;
case 905:
blendmode = HWR_TranstableToAlpha(tr_trans60, pSurf);
break;
case 906:
blendmode = HWR_TranstableToAlpha(tr_trans70, pSurf);
break;
case 907:
blendmode = HWR_TranstableToAlpha(tr_trans80, pSurf);
break;
case 908:
blendmode = HWR_TranstableToAlpha(tr_trans90, pSurf);
break;
// Translucent
case 102:
case 121:
@@ -1255,7 +1228,10 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf)
blendmode = PF_Translucent;
break;
default:
blendmode = PF_Masked;
if (gl_linedef->alpha > 0 && gl_linedef->alpha < FRACUNIT)
blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), pSurf);
else
blendmode = PF_Masked;
break;
}
}
+5
View File
@@ -94,6 +94,7 @@ enum line_e {
line_sidenum,
line_frontside,
line_backside,
line_alpha,
line_slopetype,
line_frontsector,
line_backsector,
@@ -115,6 +116,7 @@ static const char *const line_opt[] = {
"sidenum",
"frontside",
"backside",
"alpha",
"slopetype",
"frontsector",
"backsector",
@@ -652,6 +654,9 @@ static int line_get(lua_State *L)
return 0;
LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE);
return 1;
case line_alpha:
lua_pushfixed(L, line->alpha);
return 1;
case line_slopetype:
switch(line->slopetype)
{
+13
View File
@@ -1071,6 +1071,8 @@ static void P_SetupLines(void)
ld->dx = v2->x - v1->x;
ld->dy = v2->y - v1->y;
ld->alpha = FRACUNIT;
if (!ld->dx)
ld->slopetype = ST_VERTICAL;
else if (!ld->dy)
@@ -1177,6 +1179,17 @@ static void P_LoadLineDefs2(void)
M_Memcpy(ld->text+strlen(ld->text)+1, sides[ld->sidenum[1]].text, strlen(sides[ld->sidenum[1]].text)+1);
}
break;
case 900: //Translucent wall (10%)
case 901: //Translucent wall (20%)
case 902: //Translucent wall (30%)
case 903: //Translucent wall (40%)
case 904: //Translucent wall (50%)
case 905: //Translucent wall (60%)
case 906: //Translucent wall (70%)
case 907: //Translucent wall (80%)
case 908: //Translucent wall (90%)
ld->alpha = ((909 - ld->special) << FRACBITS)/10;
break;
}
}
}
+2
View File
@@ -402,6 +402,8 @@ typedef struct line_s
// Visual appearance: sidedefs.
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided
fixed_t alpha; // translucency
UINT8 blendmode; // blendmode
fixed_t bbox[4]; // bounding box for the extent of the linedef
+35 -21
View File
@@ -287,6 +287,28 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
}
}
transnum_t R_GetLinedefTransTable(fixed_t alpha)
{
if (alpha < 9830)
return tr_trans90;
else if (alpha < 16384)
return tr_trans80;
else if (alpha < 22937)
return tr_trans70;
else if (alpha < 29491)
return tr_trans60;
else if (alpha < 36044)
return tr_trans50;
else if (alpha < 42598)
return tr_trans40;
else if (alpha < 49152)
return tr_trans30;
else if (alpha < 55705)
return tr_trans20;
else
return tr_trans10;
}
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{
size_t pindex;
@@ -314,28 +336,20 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
// hack translucent linedef types (900-909 for transtables 1-9)
ldef = curline->linedef;
switch (ldef->special)
if (ldef->alpha > 0 && ldef->alpha < FRACUNIT)
{
case 900:
case 901:
case 902:
case 903:
case 904:
case 905:
case 906:
case 907:
case 908:
dc_transmap = R_GetTranslucencyTable((ldef->special-899));
colfunc = fuzzcolfunc;
break;
case 909:
colfunc = R_DrawFogColumn_8;
windowtop = frontsector->ceilingheight;
windowbottom = frontsector->floorheight;
break;
default:
colfunc = wallcolfunc;
break;
dc_transmap = transtables + ((R_GetLinedefTransTable(ldef->alpha) - 1) << FF_TRANSSHIFT);
colfunc = fuzzcolfunc;
}
else if (ldef->special == 909)
{
colfunc = R_DrawFogColumn_8;
windowtop = frontsector->ceilingheight;
windowbottom = frontsector->floorheight;
}
else
{
colfunc = wallcolfunc;
}
if (curline->polyseg && curline->polyseg->translucency > 0)
+1
View File
@@ -18,6 +18,7 @@
#pragma interface
#endif
transnum_t R_GetLinedefTransTable(fixed_t alpha);
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2);
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor);
void R_StoreWallRange(INT32 start, INT32 stop);