1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-29 22:56:07 -04:00

export ds1.SubstitutionType

This commit is contained in:
gravestench 2021-03-30 11:22:34 -07:00
parent b155f970df
commit 5074ed24ed
2 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ type DS1 struct {
version ds1version
Act int32 // Act, from 1 to 5. This tells which Act table to use for the Objects list
substitutionType int32 // SubstitutionType (layer type): 0 if no layer, else type 1 or type 2
SubstitutionType int32 // SubstitutionType (layer type): 0 if no layer, else type 1 or type 2
unknown1 []byte
unknown2 uint32
}
@ -104,12 +104,12 @@ func (ds1 *DS1) loadHeader(br *d2datautils.StreamReader) error {
}
if ds1.version.specifiesSubstitutionType() {
ds1.substitutionType, err = br.ReadInt32()
ds1.SubstitutionType, err = br.ReadInt32()
if err != nil {
return fmt.Errorf("reading substitution type: %w", err)
}
switch ds1.substitutionType {
switch ds1.SubstitutionType {
case subType1, subType2:
ds1.PushSubstitution(&layer{})
}
@ -282,7 +282,7 @@ func (ds1 *DS1) loadSubstitutions(br *d2datautils.StreamReader) error {
var err error
hasSubstitutions := ds1.version.hasSubstitutions() &&
(ds1.substitutionType == subType1 || ds1.substitutionType == subType2)
(ds1.SubstitutionType == subType1 || ds1.SubstitutionType == subType2)
if !hasSubstitutions {
ds1.substitutionGroups = make([]SubstitutionGroup, 0)
@ -548,7 +548,7 @@ func (ds1 *DS1) Marshal() []byte {
}
if ds1.version.specifiesSubstitutionType() {
sw.PushInt32(ds1.substitutionType)
sw.PushInt32(ds1.SubstitutionType)
}
if ds1.version.hasFileList() {
@ -592,7 +592,7 @@ func (ds1 *DS1) Marshal() []byte {
// Step 4 - encode Substitutions
hasSubstitutions := ds1.version.hasSubstitutions() &&
(ds1.substitutionType == subType1 || ds1.substitutionType == subType2)
(ds1.SubstitutionType == subType1 || ds1.SubstitutionType == subType2)
if hasSubstitutions {
sw.PushUint32(ds1.unknown2)

View File

@ -177,7 +177,7 @@ func exampleData() *DS1 { //nolint:funlen // not a big deal if this is long func
substitutionGroups: nil,
version: 17,
Act: 1,
substitutionType: 0,
SubstitutionType: 0,
unknown1: make([]byte, 8),
unknown2: 20,
}