From 3f6131302c1240cf58087e0f693f2c6a6c96c85c Mon Sep 17 00:00:00 2001 From: Galaco Date: Sun, 1 Sep 2024 16:37:31 +0900 Subject: [PATCH] Additional test cases --- bsp_test.go | 8 +++++ crc_test.go | 5 +++ lump/primitive/game/staticprop.go | 60 ++++++++++++++++++++++++++++++- reader_test.go | 5 +++ writer_test.go | 4 +++ 5 files changed, 81 insertions(+), 1 deletion(-) diff --git a/bsp_test.go b/bsp_test.go index a1c2f03..4eb6f8d 100644 --- a/bsp_test.go +++ b/bsp_test.go @@ -21,6 +21,14 @@ func Test_ExportedLumpBytesAreCorrect(t *testing.T) { name: "de_dust2", filePath: "testdata/v20/de_dust2.bsp.gz", }, + { + name: "cs_italy", + filePath: "testdata/v20/cs_italy.bsp.gz", + }, + { + name: "ze_bioshock_v8", + filePath: "testdata/v20/ze_bioshock_v8.bsp.gz", + }, { name: "ar_baggage", filePath: "testdata/v21/ar_baggage.bsp.gz", diff --git a/crc_test.go b/crc_test.go index 591b410..8abda61 100644 --- a/crc_test.go +++ b/crc_test.go @@ -19,6 +19,11 @@ func TestBsp_Crc(t *testing.T) { filePath: "testdata/v20/de_dust2.bsp.gz", expected: 3380635791, }, + { + name: "ze_bioshock_v8", + filePath: "testdata/v20/ze_bioshock_v8.bsp.gz", + expected: 3383242764, + }, { name: "ar_baggage", filePath: "testdata/v21/ar_baggage.bsp.gz", diff --git a/lump/primitive/game/staticprop.go b/lump/primitive/game/staticprop.go index a177d5c..0848327 100644 --- a/lump/primitive/game/staticprop.go +++ b/lump/primitive/game/staticprop.go @@ -34,8 +34,66 @@ type StaticPropLeafLump struct { Leaf []uint16 // Slice length must equal leafEntries. Validation to be added } +type StaticProp struct { + // GetOrigin Origin of object in world + Origin mgl32.Vec3 + // GetAngles Rotation of object in world + Angles mgl32.Vec3 + // GetUniformScale Uniform scale of object in world + // v11 onwards + UniformScale float32 `bsp:"v11"` + // GetPropType + PropType uint16 + // GetFirstLeaf Index into StaticPropLeafLump + FirstLeaf uint16 + // GetLeafCount Number of leafs this prop is in + LeafCount uint16 + // GetSolid + Solid uint8 + // GetFlags + Flags uint8 + // GetSkin Skin index of this prop + Skin int32 + // GetFadeMinDist + FadeMinDist float32 + // GetFadeMaxDist + FadeMaxDist float32 + // GetLightingOrigin World position to sample light from. + LightingOrigin mgl32.Vec3 + // GetForcedFadeScale + // v5 onwards + ForcedFadeScale float32 `bsp:"v5,v6,v7,v8,v9,v10,v11"` + // GetMinDXLevel Minimum directx level to render this prop + // v6+7 only + MinDXLevel uint16 `bsp:"v6,v7"` + // GetMaxDXLevel Maximum directx level to render this prop + // v6+7 only + MaxDXLevel uint16 `bsp:"v6,v7"` + // GetMinCPULevel Minimum CPU type to render this prop + // v8 onwards + MinCPULevel uint8 `bsp:"v8,v9,v10,v11"` + // GetMaxCPULevel Maximum CPU type to render this prop + // v8 onwards + MaxCPULevel uint8 `bsp:"v8,v9,v10,v11"` + // GetMinGPULevel + // v8 onwards + MinGPULevel uint8 `bsp:"v8,v9,v10,v11"` + // GetMaxGPULevel + // v8 onwards + MaxGPULevel uint8 `bsp:"v8,v9,v10,v11"` + // GetDiffuseModulation + // v7 onwards + DiffuseModulation float32 `bsp:"v7,v8,v9,v10,v11"` + // GetUnknown + // v10 onwards + Unknown float32 `bsp:"v10,v11"` + // GetDisableXBox360 Should be disabled on xbox 360? + // v9 onwards + DisableXBox360 bool `bsp:"v9,v10,v11"` +} + // IStaticPropDataLump There are many different staticprop versions -// This interface should be up to date with all possible properties +// This interface should be up-to-date with all possible properties // for any version. // Missing properties across version should return 0,false,"" etc type IStaticPropDataLump interface { diff --git a/reader_test.go b/reader_test.go index 9a450b3..d625cc1 100644 --- a/reader_test.go +++ b/reader_test.go @@ -19,6 +19,11 @@ func TestReadFromStream(t *testing.T) { filePath: "testdata/v20/de_dust2.bsp.gz", expectedError: nil, }, + { + name: "ze_bioshock_v8", + filePath: "testdata/v20/ze_bioshock_v8.bsp.gz", + expectedError: nil, + }, { name: "ar_baggage", filePath: "testdata/v21/ar_baggage.bsp.gz", diff --git a/writer_test.go b/writer_test.go index a8ba72f..aba3c62 100644 --- a/writer_test.go +++ b/writer_test.go @@ -32,6 +32,10 @@ func TestWriter_Write(t *testing.T) { name: "de_nuke", filePath: "testdata/v20/de_nuke.bsp.gz", }, + { + name: "cs_italy", + filePath: "testdata/v20/cs_italy.bsp.gz", + }, { name: "de_tides", filePath: "testdata/v20/de_tides.bsp.gz",