Source the palette name from data
This commit is contained in:
@@ -2,6 +2,7 @@ package assetstore
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -10,6 +11,7 @@ import (
|
||||
"code.ur.gs/lupine/ordoor/internal/config"
|
||||
"code.ur.gs/lupine/ordoor/internal/data"
|
||||
"code.ur.gs/lupine/ordoor/internal/idx"
|
||||
"code.ur.gs/lupine/ordoor/internal/palettes"
|
||||
)
|
||||
|
||||
type entryMap map[string]map[string]string
|
||||
@@ -29,7 +31,7 @@ type entryMap map[string]map[string]string
|
||||
// or instantiate two separate asset stores.
|
||||
type AssetStore struct {
|
||||
RootDir string
|
||||
// Palette
|
||||
Palette color.Palette
|
||||
|
||||
// Case-insensitive file lookup.
|
||||
// {"":{"anim":"Anim", "obj":"Obj", ...}, "anim":{ "warhammer.ani":"WarHammer.ani" }, ...}
|
||||
@@ -56,8 +58,14 @@ func New(engine *config.Engine) (*AssetStore, error) {
|
||||
return nil, fmt.Errorf("Unconfigured engine passed to assetstore")
|
||||
}
|
||||
|
||||
palette, ok := palettes.Get(engine.Palette)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Couldn't find palette %q for engine", engine.Palette)
|
||||
}
|
||||
|
||||
store := &AssetStore{
|
||||
RootDir: engine.DataDir,
|
||||
Palette: palette,
|
||||
}
|
||||
|
||||
// fill entryMap
|
||||
|
Reference in New Issue
Block a user