[Gtkradiant] [Bug 288] q3map barfs if more than 3 root shaders are specified for terrain

gtkradiant@zerowing.idsoftware.com gtkradiant@zerowing.idsoftware.com
Mon, 07 Jan 2002 23:26:01 -0600


http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=288





------- Additional Comments From rfm@redshift.com  2002-01-07 23:26 -------
Here's some additional information and a patch that fixes it for me. I don't
promise that the patch is right, but it fixes one problem. After making these
changes I was able to comple a map with 5 root shaders, and view it in RTCW.
Each of the shaders seems to be rendered. 

The patch is against 1.1.1. It's only 2 lines of code.

The whole problem stems from an off-by-one error in
tools\quake3\q3map\shaders.c:SurfaceForShader
where the surfaces buffer is expanded. After expansion, the new memory is
suspposed to be zeroed, but the first new slot is not. Because the slot is not
cleared, the later function (specifically EmitTerrainVerts) don't know to
initialize it. In debug on win32 at least, realloc seems to fill the memory with
0xcd, so this value gets sent off to malloc. 

I suspect (but can't prove) that the line where num_layers was forced to 3 in
SetTerrainTextures was an attempt to workaround this bug. 




------- You are receiving this mail because: -------
Whoops!  I have no idea!