mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-08 17:46:24 -05:00
adding loader for level maze details (#377)
This commit is contained in:
parent
485e60683b
commit
3fe57700a5
56
d2common/d2data/d2datadict/level_maze.go
Normal file
56
d2common/d2data/d2datadict/level_maze.go
Normal file
@ -0,0 +1,56 @@
|
||||
package d2datadict
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
type LevelMazeDetailsRecord struct {
|
||||
// descriptive, not loaded in game. Corresponds with Name field in
|
||||
// Levels.txt
|
||||
Name string // Name
|
||||
|
||||
// ID from Levels.txt
|
||||
// NOTE: Cave 1 is the Den of Evil, its associated treasure level is quest
|
||||
// only.
|
||||
LevelId int // Level
|
||||
|
||||
// the minimum number of .ds1 map sections that will make up the maze in
|
||||
// Normal, Nightmare and Hell difficulties.
|
||||
NumRoomsNormal int // Rooms
|
||||
NumRoomsNightmare int // Rooms(N)
|
||||
NumRoomsHell int // Rooms(H)
|
||||
|
||||
// the size in the X\Y direction of any component ds1 map section.
|
||||
SizeX int // SizeX
|
||||
SizeY int // SizeY
|
||||
|
||||
// Possibly related to how adjacent .ds1s are connected with each other,
|
||||
// but what the different values are for is unknown.
|
||||
// Merge int // Merge
|
||||
|
||||
// Included in the original Diablo II beta tests and in the demo version.
|
||||
// Beta
|
||||
}
|
||||
|
||||
var LevelMazeDetails map[int]*LevelMazeDetailsRecord
|
||||
|
||||
func LoadLevelMazeDetails(file []byte) {
|
||||
dict := d2common.LoadDataDictionary(string(file))
|
||||
numRecords := len(dict.Data)
|
||||
LevelMazeDetails = make(map[int]*LevelMazeDetailsRecord, numRecords)
|
||||
for idx, _ := range dict.Data {
|
||||
record := &LevelMazeDetailsRecord{
|
||||
Name: dict.GetString("Name", idx),
|
||||
LevelId: dict.GetNumber("Level", idx),
|
||||
NumRoomsNormal: dict.GetNumber("Rooms", idx),
|
||||
NumRoomsNightmare: dict.GetNumber("Rooms(N)", idx),
|
||||
NumRoomsHell: dict.GetNumber("Rooms(H)", idx),
|
||||
SizeX: dict.GetNumber("SizeX", idx),
|
||||
SizeY: dict.GetNumber("SizeY", idx),
|
||||
}
|
||||
LevelMazeDetails[record.LevelId] = record
|
||||
}
|
||||
log.Printf("Loaded %d LevelMazeDetails records", len(LevelMazeDetails))
|
||||
}
|
@ -173,7 +173,9 @@ const (
|
||||
ObjectType = "/data/global/excel/objtype.bin"
|
||||
LevelWarp = "/data/global/excel/LvlWarp.bin"
|
||||
LevelDetails = "/data/global/excel/Levels.txt"
|
||||
LevelMaze = "/data/global/excel/LvlMaze.txt"
|
||||
LevelSubstitutions = "/data/global/excel/LvlSub.txt"
|
||||
|
||||
ObjectDetails = "/data/global/excel/Objects.txt"
|
||||
SoundSettings = "/data/global/excel/Sounds.txt"
|
||||
ItemStatCost = "/data/global/excel/ItemStatCost.txt"
|
||||
|
1
main.go
1
main.go
@ -412,6 +412,7 @@ func loadDataDict() error {
|
||||
{d2resource.DifficultyLevels, d2datadict.LoadDifficultyLevels},
|
||||
{d2resource.AutoMap, d2datadict.LoadAutoMaps},
|
||||
{d2resource.LevelDetails, d2datadict.LoadLevelDetails},
|
||||
{d2resource.LevelMaze, d2datadict.LoadLevelMazeDetails},
|
||||
{d2resource.LevelSubstitutions, d2datadict.LoadLevelSubstitutions},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user