From d6cbd7e9f97ce00bbc4f484d45b134d2a01402d3 Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 20 Dec 2024 15:57:14 +0500 Subject: [PATCH] mbspc: less crude HL_FixContentsTextures: fixes tex alignment on liquids --- tools/mbspc/mbspc/map_hl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/mbspc/mbspc/map_hl.c b/tools/mbspc/mbspc/map_hl.c index fbd58156..4cf1ca20 100644 --- a/tools/mbspc/mbspc/map_hl.c +++ b/tools/mbspc/mbspc/map_hl.c @@ -899,7 +899,7 @@ void HL_FixContentsTextures(bspbrush_t *brushlist) for (i = 0; i < brush->numsides; i++) { texinfonum = brush->sides[i].texinfo; - if (HL_TextureContents(map_texinfo[texinfonum].texture) == brush->side) break; + if (texinfonum >= 0 && HL_TextureContents(map_texinfo[texinfonum].texture) == brush->side) break; } //end for //if no specific contents texture was found if (i >= brush->numsides) @@ -917,10 +917,12 @@ void HL_FixContentsTextures(bspbrush_t *brushlist) // if (texinfonum >= 0) { - //give all the brush sides this contents texture + //replace all non matching brush sides texinfos with this contents texture for (i = 0; i < brush->numsides; i++) { - brush->sides[i].texinfo = texinfonum; + const int ti = brush->sides[i].texinfo; + if(ti < 0 || HL_TextureContents(map_texinfo[ti].texture) != brush->side) + brush->sides[i].texinfo = texinfonum; } //end for } //end if else Log_Print("brush contents %d with wrong textures\n", brush->side);