Browse Source

Draw lava, slime and teleporters as liquids, but not transparent.

unrollquadloop
Nico de Poel 3 years ago
parent
commit
542a81b68c
  1. 4
      draw.h
  2. 2
      ps1bsp.h
  3. BIN
      test.ps1bsp
  4. 4
      world.c

4
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

2
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

BIN
test.ps1bsp

4
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

Loading…
Cancel
Save