[SOLVED] assertion failure: FaceTexdef_exportTokens: bad texdef

Hello everyone,
This thread is merely an information dump for future reference, so in case you are not coincidentally experiencing the exact same error at this moment in time you can safely ignore this thread.


Background:
I was working on the Bergen port for ET: Legacy and I got prompted an error message, that I have never ever seen before. I have searched for it on the internet, but also haven’t found anything, so I thought I’d post it here for anyone who encounters that error in the future. In my opinion it is quite useful information, because on the first sight and without deeper knowledge it appears that your map is completely corrupted and gone as you can’t open it anymore.


Time to error:
I have been modifying a staircase to perfectly fit into the given structure. By modifying I mean any form of transformation, rotating, cloning, copying, clipping, merging, etc. While doing that I noticed that a texture which was applied to a part of the staircase was streched quite badly. I’m 100% sure that I haven’t touched that specific brush or even the brush side the texture was on. I took note of the texture flaw to later come back to it when the overall staircase is fitted into the structure. Other than that I haven’t noticed anything unusual.


Time of error:
Apparently the texture flaw was of more serious notion, because in the exact same second the Radiant prompted me the notification that it is currently auto-saving the map, it froze and I received the error message below. Repeadetly pressing [ENTER] and [ESC] actually removed the error message, but after doing anything it appeared again. Only option was to kill the Radiant task.

[SOLVED] assertion failure: FaceTexdef_exportTokens: bad texdef

Code:
radiant/brushtokens.h:326
assertion failure: FaceTexdef_exportTokens: bad texdef
----------------

Stacktrace is disabled on this compiler
----------------
Please report this error to the developers

Aftermath:
So, the Radiant has been ‘force-shutdowned’. I reopened Radiant and tried to load the map. It started loading the necessary data and the map name etc disappeared in the window. However the Brush- and Entitycounter didn’t load which was weird and even after minutes nothing got loaded into Radiant. Several retries without a change later, I opened the console and discovered the following output. 50812:69: parse error at ‘-1.#IND’: expected ‘#number’
Again a completely new error message that I have never encountered before. Obviously the mapfile is corrupted and can’t be loaded, however the amount of work that already went into it is far too big to just start all over again, so I decided to investigate.

Code:
Loading map from D:/Programme/Wolfenstein - Enemy Territory/etmain/maps/etl_bergen_errorBrushToken.map
Open file D:/Programme/Wolfenstein - Enemy Territory/etmain/maps/etl_bergen_errorBrushToken.map for read...success
Texture load failed: "textures/"
Loaded Texture: "textures/metal_misc/ametal_m01"
Loaded Texture: "textures/common/caulk"
Loaded Texture: "textures/common/clip"
Loaded Texture: "textures/skies/topclouds"
Loaded Texture: "textures/temperate_sd/dirt_m03icmp_brown"
Loaded Texture: "textures/common/skip"
Loaded Texture: "textures/common/hint"
Loaded Texture: "textures/cathedrale_wall/cathedrale_c09"
[...]
Loaded Texture: "textures/town_floor/floor_d01"
Loaded Texture: "textures/wood/wood_c01"
Loaded Texture: "textures/wood/wood_m02"
Loaded Texture: "textures/xlab_wall/xtrim_c05"
50812:69: parse error at '-1.#IND': expected '#number'
brush 4020: parse error
entity 0: parse error
map load timer:  4.12 second(s) elapsed
--- LoadMapFile ---
D:/Programme/Wolfenstein - Enemy Territory/etmain/maps/etl_bergen_errorBrushToken.map
0 primitive
0 entities

Investigation:
So, I opened the .map file in the standard Windows notepad and had a look. Thankfully it wasn’t empty and the structure appeared to be completely fine. At this point I let out a huge sigh, because apparently this time W:ET didn’t screw me over completely. I searched the notepad for “-1.#IND” and luckily I received a lot of entries for this search. The first one being “brush 4020”, which was named in the console output as well. Below you find an extract from the map file containing all the data for brush 4020. It becomes obvious quite quickly that the problem lies within the texture coordinates of some of the brush sides.

Code:
// brush 4020
{
( 6203 68 -22 ) ( 6387 68 106 ) ( 6171 68 -22 ) awf/floor_m4 116 104 0 -0.75 0.25 134217728 0 0
( 6387 68 106 ) ( 6387 64 106 ) ( 6373 64 106 ) common/caulk 4 32 -0 0.25 -0.25 134217728 0 0
( 6171 64 -22 ) ( 6387 64 106 ) ( 6203 64 -22 ) awf/floor_m4 116 104 0 -0.75 0.25 134217728 0 0
( 6387 64 106 ) ( 6387 68 106 ) ( 6203 64 -22 ) awf/floor_m4 116 192 0 -0.75 0.25 134217728 0 0
( 6203 64 -22 ) ( 6203 68 -22 ) ( 6171 64 -22 ) common/caulk -1.#IND 32 90 -1.#IND 0.5 134217728 0 0
( 6171 64 -22 ) ( 6171 68 -22 ) ( 6373 64 106 ) common/caulk -1.#IND 32 90 -1.#IND 0.5 134217728 0 0
}

Solution:
From here on out the solution was quite simple: Find&Replace “.#IND” with 0. This way all corrupted brush faces with the unknown texture alignement -1.#IND now have the texure alignement of -1, which can be understood by the Radiant.

Note:
Take note of the textures that are affected. As long as they are /common/ textures like for example caulk, clip, trigger etc. an alignement of -1 is no problem. However as soon as they are actual textures that stretch will become visible to the player, so maybe replace the whole thing with 0 or have a look at all affected brushes later-on in Radiant and manually fix all faulty alignements.

Why I wrote this post:
Mainly because I haven’t discovered a fix to this error online and to a beginner it looks like all the hard work has completely vanished. However, I also posted this so you can see that, whenever you encounter an error that is new to you and the internet or an error that seems to be totally unsolveable and destroying everything, you should never give up. W:ET has some of the most creative ways of screwing up all your work and we just can’t let it win. Whenever, you encounter a bug, check the internet, check the console output and check your map-file for anything that is out of the usual. Keep up the work and don’t let W:ET push you down.

Cheers

source:http://forums.warchest.com/showthread.php/54999-SOLVED-assertion-failure-FaceTexdef_exportTokens-bad-texdef?p=558238#post558238