Skip to content

Commit

Permalink
Additional test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Galaco committed Sep 1, 2024
1 parent 883c4a7 commit 3f61313
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
8 changes: 8 additions & 0 deletions bsp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions crc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
60 changes: 59 additions & 1 deletion lump/primitive/game/staticprop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3f61313

Please sign in to comment.