Skip to content

Commit

Permalink
Forced correct sprp lump entry size for v10 staticprops
Browse files Browse the repository at this point in the history
  • Loading branch information
Galaco committed Apr 20, 2021
1 parent ebc16e8 commit bb99afb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/galaco/bsp
go 1.12

require (
github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a // indirect
github.com/go-gl/mathgl v1.0.0
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a h1:yoAEv7yeWqfL/l9A/J5QOndXIJCldv+uuQB1DSNQbS0=
github.com/go-gl/mathgl v0.0.0-20190713194549-592312d8590a/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
github.com/go-gl/mathgl v1.0.0 h1:t9DznWJlXxxjeeKLIdovCOVJQk/GzDEL7h/h+Ro2B68=
github.com/go-gl/mathgl v1.0.0/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f h1:FO4MZ3N56GnxbqxGKqh+YTzUWQ2sDwtFQEZgLOxh9Jc=
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a h1:gHevYm0pO4QUbwy8Dmdr01R5r1BuKtfYqRqF0h/Cbh0=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2 changes: 1 addition & 1 deletion lumps/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (lump *Game) GetStaticPropLump() *primitives.StaticPropLump {
props[idx] = primitives.IStaticPropDataLump(&vprops[idx])
}
case 10:
propLumpSize = int(unsafe.Sizeof(primitives.StaticPropV10{})) * int(numProps)
propLumpSize = 76 * int(numProps)
vprops := make([]primitives.StaticPropV10, numProps)
err = binary.Read(bytes.NewBuffer(sprpLump.Data[offset:offset+propLumpSize]), binary.LittleEndian, &vprops)
if err != nil {
Expand Down
15 changes: 11 additions & 4 deletions primitives/game/staticpropv10.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ type StaticPropV10 struct {
MinGPULevel uint8
MaxGPULevel uint8
DiffuseModulation float32
Unknown float32
//DisableXBox360 bool
DisableXBox360 bool
ExtraFlags int32
_ byte
_ byte
_ byte
}

// GetOrigin Origin of object in world
Expand Down Expand Up @@ -132,13 +135,17 @@ func (l *StaticPropV10) GetDiffuseModulation() float32 {
return l.DiffuseModulation
}

// GetExtraFlags
func (l *StaticPropV10) GetExtraFlags() int32 {
return l.ExtraFlags
}

// GetUnknown
// Not defined in v10
func (l *StaticPropV10) GetUnknown() float32 {
return 0
}

// GetDisableXBox360 should disable on XBox 360
func (l *StaticPropV10) GetDisableXBox360() bool {
return true
return l.DisableXBox360
}

0 comments on commit bb99afb

Please sign in to comment.