一直都想把Hl2的BSP的文件给分析分析,之前也尝试过很多次,可一直进展缓慢,昨天又看了一下一个BSPLoad的源码,终于知道是个什么概念了…………
头文件中包含:BSP文件的版本号等信息.
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/1327ab569c1ae82736693a50b8e33378.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0196c3df5ea9e936f21e9932cca91014.gif)
这个结构体包含以下信息:
ident BSP文件类型(id的IBSP, Valve的VBSP)
version 版本信息
lump_t 数据块信息数组
mapRevision 地图修改信息
lump_t结构体如下:
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/1327ab569c1ae82736693a50b8e33378.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0196c3df5ea9e936f21e9932cca91014.gif)
fileofs 偏移位置,也就是在文件中的起始位置
filelen 长度
version 版本
fourCC[4] 4位字符…………没有太明白它的含义,读取出来都是0
宏名 | 数据结构 |
LUMP_MODELS | dmodel_t |
LUMP_VERTEXES | dvertex_t |
LUMP_PLANES | dplane_t |
LUMP_NODES | dnode_t |
LUMP_TEXINFO | texinfo |
LUMP_TEXDATA | dtexdata_t |
LUMP_DISPINFO | g_dispinfo |
LUMP_DISP_VERTS | g_DispVerts |
LUMP_DISP_TRIS | g_DispTris |
LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS | g_DispLightmapSamplePositions |
LUMP_FACE_MACRO_TEXTURE_INFO | g_FaceMacroTextureInfos |
LUMP_FACES | dface_t |
LUMP_FACES_HDR | dface_t |
LUMP_PRIMITIVES | dprimitive_t |
LUMP_PRIMVERTS | dprimvert_t |
LUMP_PRIMINDICES | unsigned short |
LUMP_ORIGINALFACES | dface_t |
LUMP_LEAFFACES | dleaffaces[0] |
LUMP_LEAFBRUSHES | dleafbrushes[0] |
LUMP_SURFEDGES | dsurfedges[0] |
LUMP_EDGES | dedge_t |
LUMP_BRUSHES | dbrush_t |
LUMP_BRUSHSIDES | dbrushside_t |
LUMP_AREAS | darea_t |
LUMP_AREAPORTALS | dareaportal_t |
LUMP_VISIBILITY | 1 |
LUMP_LIGHTING | dlightdataLDR |
LUMP_LIGHTING_HDR | dlightdataHDR |
LUMP_LEAF_AMBIENT_LIGHTING | g_LeafAmbientLightingLDR |
LUMP_LEAF_AMBIENT_LIGHTING_HDR | g_LeafAmbientLightingHDR |
LUMP_ENTITIES | dentdata |
LUMP_WORLDLIGHTS | dworldlight_t |
LUMP_WORLDLIGHTS_HDR | dworldlight_t |
LUMP_LIGHTMAPPAGES | g_dLightmapPages |
LUMP_LIGHTMAPPAGEINFOS | g_dLightmapPageInfos |
LUMP_PORTALS | dportal_t |
LUMP_CLUSTERS | dcluster_t |
LUMP_LEAFWATERDATA | dleafwaterdata_t |
LUMP_PORTALVERTS | unsigned short |
LUMP_CLUSTERPORTALS | unsigned short |
LUMP_PHYSCOLLIDE | (void**)&g_pPhysCollide |
LUMP_VERTNORMALS | g_vertnormals[0] |
LUMP_VERTNORMALINDICES | g_vertnormalindices[0] |
LUMP_CLIPPORTALVERTS | g_ClipPortalVerts[0] |
LUMP_CUBEMAPS | g_CubemapSamples[0] |
LUMP_TEXDATA_STRING_DATA | g_TexDataStringData |
LUMP_TEXDATA_STRING_TABLE | g_TexDataStringTable |
LUMP_OVERLAYS | g_Overlays[0] |
LUMP_WATEROVERLAYS | g_WaterOverlays[0] |
LUMP_MAP_FLAGS | flags_lump |
LUMP_LEAFMINDISTTOWATER | g_LeafMinDistToWater[0] |
LUMP_PAKFILE | ( void ** )&pakbuffer |
LUMP_LEAFS | dleaf_t |