ソースを参照

load hdr lumps when regular are empty, fix #30

Ivan Avdeev 6 年 前
コミット
e3bf059fc5
3 ファイル変更15 行追加3 行削除
  1. 11 1
      src/bsp.c
  2. 2 2
      src/bsp.h
  3. 2 0
      src/vbsp.h

+ 11 - 1
src/bsp.c

@@ -56,7 +56,12 @@ struct Lumps {
 	BSPLUMP(PakFile, uint8_t, pakfile); \
 	\
 	BSPLUMP(TexDataStringData, char, texdatastringdata); \
-	BSPLUMP(TexDataStringTable, int32_t, texdatastringtable);
+	BSPLUMP(TexDataStringTable, int32_t, texdatastringtable); \
+	\
+	BSPLUMP(FaceHDR, struct VBSPLumpFace, faces_hdr); \
+	\
+	BSPLUMP(LightMapHDR, struct VBSPLumpLightMap, lightmaps_hdr); \
+
 
 #define BSPLUMP(name,type,field) struct{const type *p;uint32_t n;} field
 	LIST_LUMPS
@@ -909,6 +914,11 @@ enum BSPLoadResult bspLoadWorldspawn(struct BSPLoadModelContext context, const c
 	LIST_LUMPS
 #undef BSPLUMP
 
+	if (lumps.lightmaps.n == 0) {
+		memcpy(&lumps.lightmaps, &lumps.lightmaps_hdr, sizeof(lumps.lightmaps));
+		memcpy(&lumps.faces, &lumps.faces_hdr, sizeof(lumps.faces));
+	}
+
 	if (lumps.pakfile.n > 0) {
 		struct Memories memories = { context.tmp, context.tmp };
 		pakfile = collectionCreatePakfile(&memories, lumps.pakfile.p, lumps.pakfile.n);

+ 2 - 2
src/bsp.h

@@ -32,8 +32,8 @@ struct BSPNode {
 };
 */
 
-#define BSP_LANDMARK_NAME_LENGTH 32
-#define BSP_MAX_LANDMARKS 8
+#define BSP_LANDMARK_NAME_LENGTH 64
+#define BSP_MAX_LANDMARKS 32
 
 struct BSPLandmark {
 	char name[BSP_LANDMARK_NAME_LENGTH];

+ 2 - 0
src/vbsp.h

@@ -33,6 +33,8 @@ enum {
 
 	VBSP_Lump_LightMapHDR = 53,
 
+	VBSP_Lump_FaceHDR = 58,
+
 	VBSP_Lump_COUNT = 64
 };