sethypeety wrote: ↑Fri Mar 28, 2025 1:24 am
Good to FINALLY have a fix for this, what exactly was causing the crash? Did it even have anything to do with the tread marks?
The bug was actually triggered when you move the first/lowest decal to a new sector and then delete it.
The game keeps a map of which decals are in which grid sector for the terrain so it can easily draw the decals for a particular sector without drawing the whole list. So when you move a decal, it has to remove it from the sectors occupied by the previous position and add it to the sectors for the new position.
Also, when you delete a decal, it has to renumber everything in the map to reflect that. So if decal 3 is deleted, decal 4 becomes 3, 5 becomes 4 etc.
The bug was that when it removed it from the map, it used the new position instead of the old position, which left references to the decal in the wrong sectors. When you move the first decal, there are references to index 0 that shouldn't be there. When you delete it, it renumbers everything in the map and since there are unexpected 0s in the map, they get renumbered to -1. Later on it tries to build a vertex buffer using that invalid index and crashes.