1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-04 09:17:17 -05:00
OpenDiablo2/d2common/d2data/d2datadict/level_maze.go
Haashi 5e1725dd7d
385/lintissues (#391)
* camera offset for ui panels :

added maprenderer viewport to be aligned left or right

calling alignement on keyPress in game_controls

* check if already aligned

* fix bugs

-forgot to assign alignement
-defaultScreenRect instead of screenRect because of issue mentionned in original comment

* remove config.json and replace go.mod line

* removing duplicate import of d2common

replacing all dh to d2common

* remove useless breaks from switch statement

* better range when value unused + prettying import

* item_affix rewrite

using return values instead of pointer references in arguments

* ebiten deprecated calls

* small fixes
2020-06-22 11:53:44 -04:00

57 lines
1.7 KiB
Go

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))
}