2020-02-01 18:55:56 -05:00
|
|
|
package d2asset
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2cof"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2dc6"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2dcc"
|
2020-07-04 22:37:13 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
2020-02-01 18:55:56 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type assetManager struct {
|
2020-07-04 22:37:13 -04:00
|
|
|
archiveManager d2interface.ArchiveManager
|
2020-07-05 00:00:00 -04:00
|
|
|
archivedFileManager d2interface.ArchivedFileManager
|
2020-07-05 13:01:44 -04:00
|
|
|
paletteManager d2interface.ArchivedPaletteManager
|
2020-04-11 14:56:47 -04:00
|
|
|
paletteTransformManager *paletteTransformManager
|
2020-07-05 13:01:44 -04:00
|
|
|
animationManager d2interface.ArchivedAnimationManager
|
2020-07-05 15:56:48 -04:00
|
|
|
fontManager d2interface.ArchivedFontManager
|
2020-02-01 18:55:56 -05:00
|
|
|
}
|
|
|
|
|
2020-06-28 22:32:34 -04:00
|
|
|
func loadDC6(dc6Path string) (*d2dc6.DC6, error) {
|
2020-02-01 18:55:56 -05:00
|
|
|
dc6Data, err := LoadFile(dc6Path)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-06-28 22:32:34 -04:00
|
|
|
dc6, err := d2dc6.Load(dc6Data)
|
2020-02-01 18:55:56 -05:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-02-26 08:39:38 -05:00
|
|
|
return dc6, nil
|
2020-02-01 18:55:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func loadDCC(dccPath string) (*d2dcc.DCC, error) {
|
|
|
|
dccData, err := LoadFile(dccPath)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-06-28 22:32:34 -04:00
|
|
|
return d2dcc.Load(dccData)
|
2020-02-01 18:55:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func loadCOF(cofPath string) (*d2cof.COF, error) {
|
|
|
|
cofData, err := LoadFile(cofPath)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-06-28 22:32:34 -04:00
|
|
|
return d2cof.Load(cofData)
|
2020-02-01 18:55:56 -05:00
|
|
|
}
|