Adding modding folder with a hacked build.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package texture
|
||||
|
||||
const (
|
||||
propertiesFileVersion uint32 = 0x00000009
|
||||
)
|
||||
@@ -0,0 +1,35 @@
|
||||
package texture
|
||||
|
||||
import "github.com/inkyblackness/hacked/ss1/serial"
|
||||
|
||||
const (
|
||||
// PropertiesSize specifies, in bytes, the length a properties structure has.
|
||||
PropertiesSize = 11
|
||||
)
|
||||
|
||||
// Properties describe additional information about a texture.
|
||||
type Properties struct {
|
||||
_ byte
|
||||
_ byte
|
||||
_ int16
|
||||
DistanceModifier int16
|
||||
Climbable byte
|
||||
_ byte
|
||||
|
||||
TransparencyControl TransparencyControl
|
||||
|
||||
AnimationGroup byte
|
||||
AnimationIndex byte
|
||||
}
|
||||
|
||||
// PropertiesList implements serial.Codable to serialize a set of texture properties.
|
||||
type PropertiesList []Properties
|
||||
|
||||
// Code serializes the list with the provided coder.
|
||||
func (list PropertiesList) Code(coder serial.Coder) {
|
||||
version := propertiesFileVersion
|
||||
coder.Code(&version)
|
||||
for i := 0; i < len(list); i++ {
|
||||
coder.Code(&list[i])
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package texture_test
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/inkyblackness/hacked/ss1/content/texture"
|
||||
)
|
||||
|
||||
func TestPropertiesSize(t *testing.T) {
|
||||
size := binary.Size(texture.Properties{})
|
||||
assert.Equal(t, texture.PropertiesSize, size)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package texture
|
||||
|
||||
import "fmt"
|
||||
|
||||
// TransparencyControl describes how a texture should be displayed.
|
||||
type TransparencyControl byte
|
||||
|
||||
var transparencyControlNames = []string{
|
||||
"Regular",
|
||||
"Space",
|
||||
"SpaceBackground",
|
||||
}
|
||||
|
||||
func (ctrl TransparencyControl) String() string {
|
||||
if int(ctrl) < len(transparencyControlNames) {
|
||||
return transparencyControlNames[ctrl]
|
||||
}
|
||||
return fmt.Sprintf("Unknown%02X", int(ctrl))
|
||||
}
|
||||
|
||||
const (
|
||||
// TransparencyControlRegular describes a typical texture.
|
||||
TransparencyControlRegular TransparencyControl = 0x00
|
||||
// TransparencyControlSpace marks space texture, which ignores bitmap data.
|
||||
TransparencyControlSpace TransparencyControl = 0x01
|
||||
// TransparencyControlSpaceBackground draws space for palette index 0x00.
|
||||
TransparencyControlSpaceBackground TransparencyControl = 0x02
|
||||
)
|
||||
|
||||
// TransparencyControls returns all known transparency control values.
|
||||
func TransparencyControls() []TransparencyControl {
|
||||
return []TransparencyControl{TransparencyControlRegular, TransparencyControlSpace, TransparencyControlSpaceBackground}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package texture_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/inkyblackness/hacked/ss1/content/texture"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTransparencyControlString(t *testing.T) {
|
||||
tt := []struct {
|
||||
ctrl texture.TransparencyControl
|
||||
expected string
|
||||
}{
|
||||
{ctrl: texture.TransparencyControlRegular, expected: "Regular"},
|
||||
{ctrl: texture.TransparencyControlSpace, expected: "Space"},
|
||||
{ctrl: texture.TransparencyControlSpaceBackground, expected: "SpaceBackground"},
|
||||
{ctrl: 0x80, expected: "Unknown80"},
|
||||
}
|
||||
|
||||
for _, tc := range tt {
|
||||
result := tc.ctrl.String()
|
||||
assert.Equal(t, tc.expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransparencyControls(t *testing.T) {
|
||||
controls := texture.TransparencyControls()
|
||||
assert.Equal(t, 3, len(controls))
|
||||
}
|
||||
Reference in New Issue
Block a user