Author Topic: Parsing BSP for list of textures  (Read 1123 times)

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Parsing BSP for list of textures
« on: December 07, 2007, 12:34:47 PM »
Are there specs for Q2 BSPs that I can read? I can find Q1 specs... maybe they're the same.

I read the Q1 specs and parsed this out of the BSP header:

(long = little endian)

string(4) magic = IBSP
long bspver = 38
long entities_offset
long entities_length
long planes_offset
long planes_length
...etc...
Using this list:
Code: [Select]
var $fields = array('entities', 'planes', 'miptex', 'vertices',
                'visilist', 'nodes', 'texinfo', 'faces', 'lightmaps',
                'clipnodes', 'leaves', 'lface', 'edges', 'ledges',
                'models');

Now, (a) is this still valid for Q2, and (b) how do I parse out the textures (it's in miptext, correct?)?

(Actually, in the mean time, I pull out miptex and use regular expressions to find strings of minimum 5 characters and with a / in them. Not very clean or accurate.)

y00tz

  • Autococker
  • Posts: 2742
Re: Parsing BSP for list of textures
« Reply #1 on: December 08, 2007, 12:23:40 AM »
forewarning: this is not a solution to your problem

But, surely Jitspoe can help you since he was able to parse maps before to calculate texture usage: http://dplogin.com/forums/index.php?topic=5386.0

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Parsing BSP for list of textures
« Reply #2 on: December 14, 2007, 02:18:49 PM »
I just did a simple find in files for "pball/", but that's not a real solution.

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Parsing BSP for list of textures
« Reply #3 on: December 14, 2007, 02:52:56 PM »
Mine is *slightly* better. :P