mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-25 11:36:26 -05: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"
|
||||
)
|
||||
|
||||
var frameFields = []string{"Cel1", "Cel2", "Cel3", "Cel4"}
|
||||
|
||||
// AutoMapRecord represents one row from d2data.mpq/AutoMap.txt.
|
||||
// Based on the information here https://d2mods.info/forum/kb/viewarticle?a=419
|
||||
type AutoMapRecord struct {
|
||||
@ -37,22 +39,22 @@ type AutoMapRecord struct {
|
||||
// whatever you like..."
|
||||
// The values seem functional but naming conventions
|
||||
// vary between LevelNames.
|
||||
Type1 string
|
||||
Type2 string
|
||||
Type3 string
|
||||
Type4 string
|
||||
//Type1 string
|
||||
//Type2 string
|
||||
//Type3 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
|
||||
// of the MaxiMap(s).dc6 that will be applied to the
|
||||
// specified tiles.
|
||||
// Frames determine the frame of the MaxiMap(s).dc6 that
|
||||
// will be applied to the specified tiles. The frames
|
||||
// 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
|
||||
// variation. The game will choose randomly between any
|
||||
// of the 4 values which are not set to -1.
|
||||
Cel1 int
|
||||
Cel2 int
|
||||
Cel3 int
|
||||
Cel4 int
|
||||
// variation. Presumably game chooses randomly between
|
||||
// any of the 4 values which are not set to -1.
|
||||
Frames []int
|
||||
}
|
||||
|
||||
// AutoMaps contains all data in AutoMap.txt.
|
||||
@ -83,15 +85,15 @@ func LoadAutoMaps(file []byte) {
|
||||
StartSequence: d.GetNumber("StartSequence", idx),
|
||||
EndSequence: d.GetNumber("EndSequence", idx),
|
||||
|
||||
Type1: d.GetString("Type1", idx),
|
||||
Type2: d.GetString("Type2", idx),
|
||||
Type3: d.GetString("Type3", idx),
|
||||
Type4: d.GetString("Type4", idx),
|
||||
//Type1: d.GetString("Type1", idx),
|
||||
//Type2: d.GetString("Type2", idx),
|
||||
//Type3: d.GetString("Type3", 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),
|
||||
Cel2: d.GetNumber("Cel2", idx),
|
||||
Cel3: d.GetNumber("Cel3", idx),
|
||||
Cel4: d.GetNumber("Cel4", idx),
|
||||
AutoMaps[idx].Frames = make([]int, len(frameFields))
|
||||
for i := range frameFields {
|
||||
AutoMaps[idx].Frames[i] = d.GetNumber(frameFields[i], idx)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user