From 542a81b68cffc4831ba305291bbe3e762613cd14 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 31 Jan 2023 11:21:41 +0100 Subject: [PATCH] Draw lava, slime and teleporters as liquids, but not transparent. --- draw.h | 4 ++-- ps1bsp.h | 2 +- test.ps1bsp | Bin 447459 -> 447459 bytes world.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/draw.h b/draw.h index d939900..df86535 100644 --- a/draw.h +++ b/draw.h @@ -256,7 +256,7 @@ static INLINE void draw_quadstrip_textured(const ps1bsp_vertex_t *vertices, cons } } -static INLINE void draw_quadstrip_water(const ps1bsp_vertex_t *vertices, const ps1bsp_polyvertex_t *polyVerts, u_char numVerts, u_short tpage, u_long *ot) +static INLINE void draw_quadstrip_water(const ps1bsp_vertex_t *vertices, const ps1bsp_polyvertex_t *polyVerts, u_char numVerts, u_short tpage, u_char semiTrans, u_long *ot) { // Draw the face as a quad strip const ps1bsp_polyvertex_t *v0, *v1, *v2, *v3; @@ -289,7 +289,7 @@ static INLINE void draw_quadstrip_water(const ps1bsp_vertex_t *vertices, const p // Draw a flat-shaded textured quad POLY_FT4 *poly = (POLY_FT4*)mem_prim(sizeof(POLY_FT4)); setPolyFT4(poly); - setSemiTrans(poly, 1); + setSemiTrans(poly, semiTrans); gte_stsxy3_ft3(poly); // Transform the fourth vertex to complete the quad diff --git a/ps1bsp.h b/ps1bsp.h index d2eb4a0..1f926ce 100755 --- a/ps1bsp.h +++ b/ps1bsp.h @@ -85,7 +85,7 @@ typedef struct } ps1bsp_facevertex_t; #define SURF_DRAWSKY 0x2 -#define SURF_DRAWTURB 0x4 +#define SURF_DRAWLIQUID 0x4 #define SURF_DRAWWATER 0x8 // High quality: Face -> polygons -> polygon vertex indices (index + UV + light) -> vertices diff --git a/test.ps1bsp b/test.ps1bsp index 1ddc31373dadc9dab80257a7477abd09dc30eae2..f1082fc06c5ced888042dad109c56ff297ad66a7 100755 GIT binary patch delta 300 zcmXBNF%H5Y6vpwO&njEjh8Po_+72eYKxa1X1)MpBnlv$-prd2MZo(P3f@>#Eq42(e z{PG7LEVEi>^%%vt8rL7%m4YT&(m{}~OS;LFw&HXZy+ul`IE|uyo6;R~P60&5%M<;I zv@09D)X+VTx|TDv)UWgDnMZ4&fdQ8BE|IT>jwfSB{XS)V;Yke)u)u);B9K>n1vD_g S0tW(!%u5cG*2c@B_&)zVbwdUK delta 300 zcmXBNF$%&k6vlC?&uXAU*Ahg~sqG;20-dvIFW{V0s8Eocprd2SF60ckf@`OoLX-Cm z;m1G8OO{zKvwV!%xEj|V+Lc)`iINUk;p&oZBBrT0ZAI@arjndmQooI9k0~b)0^`Jq zetFy#4PI*Ko09d8>GaH_HBdkU!#EpBSAEBmp`(5uv%c`80vZ@#fd>JIE4~5> UXkdT^9t7qk28wIr#E^fVf9u^uHUIzs diff --git a/world.c b/world.c index 0bce96a..5634e8e 100644 --- a/world.c +++ b/world.c @@ -142,12 +142,12 @@ static void world_drawface_textured(const world_t *world, const ps1bsp_face_t *f const ps1bsp_texture_t *texture = &world->textures[face->textureId]; const ps1bsp_polygon_t* poly = &world->polygons[face->firstPolygon]; - if (face->flags & SURF_DRAWWATER) + if (face->flags & SURF_DRAWLIQUID) { for (u_char polyIdx = 0; polyIdx < face->numPolygons; ++polyIdx, ++poly) { ps1bsp_polyvertex_t *polyVertices = &world->polyVertices[poly->firstPolyVertex]; - draw_quadstrip_water(world->vertices, polyVertices, poly->numPolyVertices, texture->tpage, ot); + draw_quadstrip_water(world->vertices, polyVertices, poly->numPolyVertices, texture->tpage, face->flags & SURF_DRAWWATER, ot); } } else