1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-16 09:25:57 -05:00
OpenDiablo2/d2core/d2records/overlays_loader.go
2020-12-18 18:46:34 +01:00

44 lines
1.0 KiB
Go

package d2records
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
func overlaysLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(Overlays)
for d.Next() {
record := &OverlayRecord{
Name: d.String("Overlay"),
Filename: d.String("Filename"),
Version: d.Bool("Version"),
PreDraw: d.Bool("PreDraw"),
XOffset: d.Number("Xoffset"),
YOffset: d.Number("Yoffset"),
Height1: d.Number("Height1"),
Height2: d.Number("Height1"),
Height3: d.Number("Height1"),
Height4: d.Number("Height1"),
AnimRate: d.Number("AnimRate"),
Trans: d.Number("Trans"),
InitRadius: d.Number("InitRadius"),
Radius: d.Number("Radius"),
Red: uint8(d.Number("Red")),
Green: uint8(d.Number("Green")),
Blue: uint8(d.Number("Blue")),
}
records[record.Name] = record
}
if d.Err != nil {
return d.Err
}
r.Debugf("Loaded %d Overlay records", len(records))
r.Layout.Overlays = records
return nil
}