Thursday, October 22, 2009

Lots of fun with LOC files

OK, this is for the benefit of anyone who's designing a new plain-text format for use with Quake:

FOR THE LOVE OF GOD, PLEASE PLEASE PLEASE MAKE SURE THAT IT'S READABLE BY COM_PARSE!!!

This is not a joke. There is a perfectly good, tried and trusted format that is used by almost all Quake files - entities, configs, even huge chunks of savegames. Why not use it? Why go design your own funky format that requires a custom reader? There is nothing wrong with COM_Parse.

Just sayin'.


Update:

LOC file support is now added. I can't say I'm overly happy here; I had to modify COM_Parse to read a full line if an optional flag was passed to it. I'm not joking about files being properly parsable by the perfectly good built-in parser; building custom formats that require their own custom parser is just playing silly buggers for the sake of it, and being awkward. At least I've got it largely going through an evil combination of sscanf and COM_Parse now, so it's kinda conformant to the Quake standard that's used for almost everything else. Somebody badly needs a slap in the face for this.

0 comments: