Wow! Thanks Katsankat! I'll check that doc. Seem to talk about details of the format. I'm mostly interested by the headers now. You have redone the FUNC_TRAIN?
Loki. I was really unsure about modifying the source. But since your comment, questionned myself and done simple test with other things related to the source. It's not to bad. I don't know why I was so afraid.
Think I will try to tweak it to see if I can load some other types of BSP in there.
If some of you have other BSP files, it would be cool if I could have access to an example file to see If I can load it. I already have access to my maps produced with Hammer/Source SDK.
EDIT: Tried it with Source SDK .BSP: It doesnt work nothing is loaded and a crash occur. Probably that the "lumps" and headers are too different. Perhaps If I have more time, and the info is right, and I'm getting better to imitate a programmer...
EDIT2:
Here are some diffences I've found:
Headers:
Code: Select all
struct tBSPHeader
{
s32 strID; // This should always be 'IBSP'
s32 version; // This should be 0x2e for Quake 3 files
};
For SourceSDK:
strID='VBSP'
version=''17, 19 or 20 dec"
IRRlicht Lumps infos:
Code: Select all
enum eLumps
{
kEntities = 0, // Stores player/object positions, etc...
kTextures, // Stores texture information
kPlanes, // Stores the splitting planes
kNodes, // Stores the BSP nodes
kLeafs, // Stores the leafs of the nodes
kLeafFaces, // Stores the leaf's indices into the faces
kLeafBrushes, // Stores the leaf's indices into the brushes
kModels, // Stores the info of world models
kBrushes, // Stores the brushes info (for collision)
kBrushSides, // Stores the brush surfaces info
kVertices, // Stores the level vertices
kMeshVerts, // Stores the model vertices offsets
kShaders, // Stores the shader files (blending, anims..)
kFaces, // Stores the faces for the level
kLightmaps, // Stores the lightmaps for the level
kLightVolumes, // Stores extra world lighting information
kVisData, // Stores PVS and cluster info (visibility)
kMaxLumps // A constant to store the number of lumps
};
SourceSDK lumps: (From web page)
Code: Select all
Lump: Name: Purpose:
0 Entities Map entities
1 Planes Plane array
2 Texdata Index to texture names
3 Vertexes Vertex array
4 Visibility Compressed visibility bit arrays
5 Nodes BSP tree nodes
6 Texinfo Face texture array
7 Faces Face array
8 Lighting Lightmap samples
9 Occlusion Occlusion data(?)
10 Leafs BSP tree leaf nodes
11 Unused
12 Edges Edge array
13 Surfedges Index of edges
14 Models Brush models (geometry of brush entities)
15 Worldlights Light entities
16 LeafFaces Index to faces in each leaf
17 LeafBrushes Index to brushes in each leaf
18 Brushes Brush array
19 Brushsides Brushside array
20 Areas Area array
21 AreaPortals Portals between areas
22 Portals Polygons defining the boundary between adjacent leaves(?)
23 Clusters Leaves that are enterable by the player
24 PortalVerts Vertices of portal polygons
25 Clusterportals Polygons defining the boundary between adjacent clusters(?)
26 Dispinfo Displacement surface array
27 OriginalFaces Brush faces array before BSP splitting
28 Unused
29 PhysCollide Physics collision data(?)
30 VertNormals Vertex normals(?)
31 VertNormalIndices Vertex normal index array(?)
32 DispLightmapAlphas Displacement lightmap data(?)
33 DispVerts Vertices of displacement surface meshes
34 DispLightmapSamplePos Displacement lightmap data(?)
35 GameLump Game-specific data lump
36 LeafWaterData (?)
37 Primitives Non-polygonal primatives(?)
38 PrimVerts (?)
39 PrimIndices (?)
40 Pakfile Embedded uncompressed-Zip format file
41 ClipPortalVerts (?)
42 Cubemaps Env_cubemap location array
43 TexdataStringData Texture name data
44 TexdataStringTable Index array into texdata string data
45 Overlays Info_overlay array
46 LeafMinDistToWater (?)
47 FaceMacroTextureInfo (?)
48 DispTris Displacement surface triangles
49 PhysCollideSurface Physics collision surface data(?)
50-52 Unused
53 LightingHDR HDR related lighting data(?)
54 WorldlightsHDR HDR related worldlight data(?)
55 LeaflightHDR1 HDR related leaf lighting data(?)
56 LeaflightHDR2 HDR related leaf lighting data(?)
57-63 Unused
Here found a list of lumps directly from source SDK:
Code: Select all
static char *s_LumpNames[] = {
"LUMP_ENTITIES", // 0
"LUMP_PLANES", // 1
"LUMP_TEXDATA", // 2
"LUMP_VERTEXES", // 3
"LUMP_VISIBILITY", // 4
"LUMP_NODES", // 5
"LUMP_TEXINFO", // 6
"LUMP_FACES", // 7
"LUMP_LIGHTING", // 8
"LUMP_OCCLUSION", // 9
"LUMP_LEAFS", // 10
"LUMP_FACEIDS", // 11
"LUMP_EDGES", // 12
"LUMP_SURFEDGES", // 13
"LUMP_MODELS", // 14
"LUMP_WORLDLIGHTS", // 15
"LUMP_LEAFFACES", // 16
"LUMP_LEAFBRUSHES", // 17
"LUMP_BRUSHES", // 18
"LUMP_BRUSHSIDES", // 19
"LUMP_AREAS", // 20
"LUMP_AREAPORTALS", // 21
"LUMP_UNUSED0", // 22
"LUMP_UNUSED1", // 23
"LUMP_UNUSED2", // 24
"LUMP_UNUSED3", // 25
"LUMP_DISPINFO", // 26
"LUMP_ORIGINALFACES", // 27
"LUMP_PHYSDISP", // 28
"LUMP_PHYSCOLLIDE", // 29
"LUMP_VERTNORMALS", // 30
"LUMP_VERTNORMALINDICES", // 31
"LUMP_DISP_LIGHTMAP_ALPHAS", // 32
"LUMP_DISP_VERTS", // 33
"LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS", // 34
"LUMP_GAME_LUMP", // 35
"LUMP_LEAFWATERDATA", // 36
"LUMP_PRIMITIVES", // 37
"LUMP_PRIMVERTS", // 38
"LUMP_PRIMINDICES", // 39
"LUMP_PAKFILE", // 40
"LUMP_CLIPPORTALVERTS", // 41
"LUMP_CUBEMAPS", // 42
"LUMP_TEXDATA_STRING_DATA", // 43
"LUMP_TEXDATA_STRING_TABLE", // 44
"LUMP_OVERLAYS", // 45
"LUMP_LEAFMINDISTTOWATER", // 46
"LUMP_FACE_MACRO_TEXTURE_INFO", // 47
"LUMP_DISP_TRIS", // 48
"LUMP_PHYSCOLLIDESURFACE", // 49
"LUMP_WATEROVERLAYS", // 50
"LUMP_LEAF_AMBIENT_INDEX_HDR", // 51
"LUMP_LEAF_AMBIENT_INDEX", // 52
"LUMP_LIGHTING_HDR", // 53
"LUMP_WORLDLIGHTS_HDR", // 54
"LUMP_LEAF_AMBIENT_LIGHTING_HDR", // 55
"LUMP_LEAF_AMBIENT_LIGHTING", // 56
"LUMP_XZIPPAKFILE", // 57
"LUMP_FACES_HDR", // 58
"LUMP_MAP_FLAGS", // 59
"LUMP_OVERLAY_FADES", // 60
};
Matching lumps are:
only the entities lump is matching. That explain why it was crashing.
That docs is really good. I'll check further (need a way to keep the old ENUM while switching to a new one if the header match a SOURCESDK one.
Still it seem encouraging that
it could be possible for a noob like me to have the BSP loader compatible with other variants...