Initial commit
I can parse some of the data files, and extract individual frames from .obj files. I can't yet convert those frames into something viewable.
This commit is contained in:
63
cmd/load/main.go
Normal file
63
cmd/load/main.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"ur.gs/chaos-gate/internal/data"
|
||||
)
|
||||
|
||||
var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
dataPath := filepath.Join(*gamePath, "Data")
|
||||
accountingPath := filepath.Join(dataPath, "Accounting.dat")
|
||||
genericDataPath := filepath.Join(dataPath, "GenericData.dat")
|
||||
aniObDefPath := filepath.Join(dataPath, "AniObDef.dat")
|
||||
|
||||
objDataPath := filepath.Join(*gamePath, "Obj")
|
||||
|
||||
log.Printf("Loading %s...", accountingPath)
|
||||
accounting, err := data.LoadAccounting(accountingPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse %s: %s", accountingPath, err)
|
||||
}
|
||||
|
||||
log.Printf("%s: %+v", accountingPath, accounting)
|
||||
|
||||
log.Printf("Loading %s...", aniObDefPath)
|
||||
animated, err := data.LoadAnimatedObjectDefinitions(aniObDefPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse %s: %s", genericDataPath, err)
|
||||
}
|
||||
|
||||
log.Printf("%s: %+v", aniObDefPath, animated)
|
||||
|
||||
log.Printf("Loading %s...", genericDataPath)
|
||||
genericData, err := data.LoadGeneric(genericDataPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse %s: %s", genericDataPath, err)
|
||||
}
|
||||
|
||||
log.Printf("%s: %+v", genericDataPath, genericData)
|
||||
|
||||
// TODO: Obj/cpiece.rec isn't loaded by this. Do we need it? How do we know?
|
||||
log.Printf("Loading %s...", objDataPath)
|
||||
objects, err := data.LoadObjects(objDataPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse %s: %s", objDataPath, err)
|
||||
}
|
||||
|
||||
log.Printf("Objects in %s:", objDataPath)
|
||||
for key, obj := range objects {
|
||||
log.Printf("\t%s: %+v", key, obj)
|
||||
}
|
||||
|
||||
log.Printf("Tzeentch: %+v", objects["TZEENTCH.OBJ"])
|
||||
log.Printf("TFrame 0: %+v", objects["TZEENTCH.OBJ"].Frames[0])
|
||||
}
|
Reference in New Issue
Block a user