id-tech-3-tools / map-compiler

id Tech 3 Map Compiler
MIT License
8 stars 4 forks source link

fix old bsp won't decompile #21

Closed isRyven closed 6 years ago

isRyven commented 6 years ago

Added Quake Live support in q3map2 2.5.17 introduced a new bsp lump, that contains advertisements data, but didn't bother to increase protocol version, or rather it is increased relatively to quake 3, but still has same protocol number as rtcw and et. Whilst trying to decompile older bsp files, that have been compiled with older map compiler, will lead to a "funny lump size" error because advertisement lump being processed despite the fact there is no more data left. This doesn't happen on a maps compiled with newer compiler versions due to the fact it still writes an empty lump information to the end of bsp, so the compiler always knows there is nothing left to fetch.

This commit adds a bsp file size check to make sure that after prelast lump, there is still a data left to process, otherwise it doen't bother to continue.