Determine the Soldiers At War palette

This commit also takes the first step towards making it configurable;
override `internal/palettes.DefaultPaletteName` at build time to choose
one palette over another. It would be nice to set this at runtime!
This commit is contained in:
2020-05-19 21:33:49 +01:00
parent 04bdf3e352
commit eea5dea98a
7 changed files with 353 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ import (
"strings"
"code.ur.gs/lupine/ordoor/internal/data/rle"
"code.ur.gs/lupine/ordoor/internal/palettes"
)
type SpriteHeader struct {
@@ -32,7 +33,7 @@ func (s SpriteHeader) Check(expectedSize uint32) error {
// TODO: WarHammer.ani sets Unknown1 to this for all 188,286 sprites. I am
// very interested in seeing if there are any others
if s.Unknown1[0] | s.Unknown1[1] | s.Unknown1[2] | s.Unknown1[3] > 0 {
if s.Unknown1[0]|s.Unknown1[1]|s.Unknown1[2]|s.Unknown1[3] > 0 {
if s.Unknown1[0] != 212 || s.Unknown1[1] != 113 || s.Unknown1[2] != 59 || s.Unknown1[3] != 1 {
log.Printf("Value of Unknown1 field: %v", s.Unknown1)
}
@@ -57,7 +58,7 @@ func (s *Sprite) ToImage() *image.Paletted {
Pix: s.Data,
Stride: int(s.Width),
Rect: image.Rect(0, 0, int(s.Width), int(s.Height)),
Palette: ColorPalette,
Palette: palettes.DefaultPalette(),
}
}