mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-18 17:26:05 -04:00
Automap corrections (#422)
* Added automap.go stub * Handle errors in original AutoMap.txt file * Completed AutoMapRecord struct and comments * AutoMap loader implemented * Update from base repo * Cel1-4 fields replaced with a slice * Commented out Type fields as they aren't used
This commit is contained in:
parent
f119d1197c
commit
897de61006
@ -7,6 +7,8 @@ import (
|
|||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var frameFields = []string{"Cel1", "Cel2", "Cel3", "Cel4"}
|
||||||
|
|
||||||
// AutoMapRecord represents one row from d2data.mpq/AutoMap.txt.
|
// AutoMapRecord represents one row from d2data.mpq/AutoMap.txt.
|
||||||
// Based on the information here https://d2mods.info/forum/kb/viewarticle?a=419
|
// Based on the information here https://d2mods.info/forum/kb/viewarticle?a=419
|
||||||
type AutoMapRecord struct {
|
type AutoMapRecord struct {
|
||||||
@ -37,22 +39,22 @@ type AutoMapRecord struct {
|
|||||||
// whatever you like..."
|
// whatever you like..."
|
||||||
// The values seem functional but naming conventions
|
// The values seem functional but naming conventions
|
||||||
// vary between LevelNames.
|
// vary between LevelNames.
|
||||||
Type1 string
|
//Type1 string
|
||||||
Type2 string
|
//Type2 string
|
||||||
Type3 string
|
//Type3 string
|
||||||
Type4 string
|
//Type4 string // Note: I commented these out for now because they supposedly aren't useful see the LoadAutoMaps function.
|
||||||
|
|
||||||
// Cel values contain numbers which determine the frame
|
// Frames determine the frame of the MaxiMap(s).dc6 that
|
||||||
// of the MaxiMap(s).dc6 that will be applied to the
|
// will be applied to the specified tiles. The frames
|
||||||
// specified tiles.
|
// are in rows, if each row holds 20 images (when you
|
||||||
|
// re-extract the chart with Dc6Table, you can specify
|
||||||
|
// how many graphics a line can hold), line 1 includes
|
||||||
|
// icons 0-19, line 2 from 20 to 39 etc.
|
||||||
//
|
//
|
||||||
// Multiple values exist for Cel (and Type) to enable
|
// Multiple values exist for Cel (and Type) to enable
|
||||||
// variation. The game will choose randomly between any
|
// variation. Presumably game chooses randomly between
|
||||||
// of the 4 values which are not set to -1.
|
// any of the 4 values which are not set to -1.
|
||||||
Cel1 int
|
Frames []int
|
||||||
Cel2 int
|
|
||||||
Cel3 int
|
|
||||||
Cel4 int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoMaps contains all data in AutoMap.txt.
|
// AutoMaps contains all data in AutoMap.txt.
|
||||||
@ -83,15 +85,15 @@ func LoadAutoMaps(file []byte) {
|
|||||||
StartSequence: d.GetNumber("StartSequence", idx),
|
StartSequence: d.GetNumber("StartSequence", idx),
|
||||||
EndSequence: d.GetNumber("EndSequence", idx),
|
EndSequence: d.GetNumber("EndSequence", idx),
|
||||||
|
|
||||||
Type1: d.GetString("Type1", idx),
|
//Type1: d.GetString("Type1", idx),
|
||||||
Type2: d.GetString("Type2", idx),
|
//Type2: d.GetString("Type2", idx),
|
||||||
Type3: d.GetString("Type3", idx),
|
//Type3: d.GetString("Type3", idx),
|
||||||
Type4: d.GetString("Type4", idx),
|
//Type4: d.GetString("Type4", idx), // Note: I commented these out for now because they supposedly aren't useful see the AutoMapRecord struct.
|
||||||
|
}
|
||||||
|
|
||||||
Cel1: d.GetNumber("Cel1", idx),
|
AutoMaps[idx].Frames = make([]int, len(frameFields))
|
||||||
Cel2: d.GetNumber("Cel2", idx),
|
for i := range frameFields {
|
||||||
Cel3: d.GetNumber("Cel3", idx),
|
AutoMaps[idx].Frames[i] = d.GetNumber(frameFields[i], idx)
|
||||||
Cel4: d.GetNumber("Cel4", idx),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user