ref: 57161a86fd06293d116ac687ea9e462c02eb7cbb
parent: a1da754ee85d9f5b17f6f67a61945f4994565c9b
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Mon Oct 16 18:45:29 EDT 2023
add r_lavaalpha and r_slimealpha; leave teleports alone (non-transparent)
--- a/d_edge.c
+++ b/d_edge.c
@@ -144,6 +144,17 @@
bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1;
}
+static float
+alphafor(surf_t *s)
+{
+ if((s->flags & (SURF_LAVA|SURF_SLIME|SURF_TELE)) == 0)
+ return r_wateralpha.value;
+ if(s->flags & SURF_LAVA)
+ return r_lavaalpha.value;
+ if(s->flags & SURF_SLIME)
+ return r_slimealpha.value;
+ return 1.0;
+}
/*
==============
@@ -234,7 +245,7 @@
}
D_CalcGradients (pface);
- Turbulent8 (s->spans, r_wateralpha.value);
+ Turbulent8 (s->spans, alphafor(s));
D_DrawZSpans (s->spans);
if (s->insubmodel)
@@ -286,8 +297,6 @@
if(s->flags & SURF_FENCE)
D_DrawSpans16_Fence(s->spans);
- else if(s->flags & SURF_TRANS)
- (*d_drawspans) (s->spans, r_wateralpha.value);
else
(*d_drawspans) (s->spans, 1.0);
--- a/model.c
+++ b/model.c
@@ -785,6 +785,12 @@
out->extents[i] = 16384;
out->texturemins[i] = -8192;
}
+ if(strstr(out->texinfo->texture->name, "lava") != nil)
+ out->flags |= SURF_LAVA;
+ if(strstr(out->texinfo->texture->name, "slime") != nil)
+ out->flags |= SURF_SLIME;
+ if(strstr(out->texinfo->texture->name, "tele") != nil)
+ out->flags |= SURF_TELE;
}else if(out->texinfo->texture->name[0] == '{')
out->flags |= SURF_TRANS | SURF_FENCE;
}
--- a/model.h
+++ b/model.h
@@ -64,6 +64,9 @@
SURF_DRAWBACKGROUND = 1<<6,
SURF_TRANS = 1<<8,
SURF_FENCE = 1<<9,
+ SURF_LAVA = 1<<10,
+ SURF_SLIME = 1<<11,
+ SURF_TELE = 1<<12,
};
// !!! if this is changed, it must be changed in asm_draw.h too !!!
--- a/r_local.h
+++ b/r_local.h
@@ -51,6 +51,8 @@
extern cvar_t r_numedges;
extern cvar_t r_part_scale;
extern cvar_t r_wateralpha;
+extern cvar_t r_lavaalpha;
+extern cvar_t r_slimealpha;
#define XCENTERING (1.0 / 2.0)
#define YCENTERING (1.0 / 2.0)
--- a/r_main.c
+++ b/r_main.c
@@ -118,6 +118,8 @@
cvar_t r_aliastransadj = {"r_aliastransadj", "100"};
cvar_t r_part_scale = {"r_part_scale", "0.75", true};
cvar_t r_wateralpha = {"r_wateralpha", "1", true};
+cvar_t r_lavaalpha = {"r_lavaalpha", "1", true};
+cvar_t r_slimealpha = {"r_slimealpha", "1", true};
extern cvar_t scr_fov;
@@ -201,6 +203,8 @@
Cvar_RegisterVariable (&r_aliastransadj);
Cvar_RegisterVariable (&r_part_scale);
Cvar_RegisterVariable (&r_wateralpha);
+ Cvar_RegisterVariable (&r_lavaalpha);
+ Cvar_RegisterVariable (&r_slimealpha);
view_clipplanes[0].leftedge = true;
view_clipplanes[1].rightedge = true;