Make the menu buttons work

This commit is contained in:
2020-03-21 18:50:26 +00:00
parent be4229b8fe
commit 46925c09d1
5 changed files with 194 additions and 66 deletions

View File

@@ -15,7 +15,8 @@ import (
var (
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
objName = flag.String("obj", "", "Name of an .obj file, e.g. TZEENTCH")
objFile = flag.String("obj-file", "", "Path of an .obj file, e.g. ./orig/Obj/TZEENTCH.OBJ")
objName = flag.String("obj-name", "", "Name of an .obj file, e.g. TZEENTCH")
)
type env struct {
@@ -36,7 +37,7 @@ type state struct {
func main() {
flag.Parse()
if *gamePath == "" || *objName == "" {
if *gamePath == "" || (*objName == "" && *objFile == "") {
flag.Usage()
os.Exit(1)
}
@@ -46,9 +47,14 @@ func main() {
log.Fatal("Failed to set up asset store: %v", err)
}
obj, err := assets.Object(*objName)
var obj *assetstore.Object
if *objName != "" {
obj, err = assets.Object(*objName)
} else {
obj, err = assets.ObjectByPath(*objFile)
}
if err != nil {
log.Fatalf("Failed to load %s: %v", *objName, err)
log.Fatalf("Failed to load %s%s: %v", *objName, *objFile, err)
}
state := state{