1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-05 09:47:18 -05:00
OpenDiablo2/d2common/d2fileformats/d2dat/d2dat.go

22 lines
326 B
Go
Raw Normal View History

package d2dat
type DATColor struct {
R uint8
G uint8
B uint8
}
type DATPalette struct {
Colors [256]DATColor
}
func LoadDAT(data []byte) (*DATPalette, error) {
palette := &DATPalette{}
for i := 0; i < 256; i++ {
palette.Colors[i] = DATColor{B: data[i*3], G: data[i*3+1], R: data[i*3+2]}
}
return palette, nil
}