d2dt1

package
v0.0.0-...-c7db75a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package d2dt1 provides functionality for loading/processing DT1 files. https://d2mods.info/forum/viewtopic.php?t=65163

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTileGfxData

func DecodeTileGfxData(blocks []Block, pixels *[]byte, tileYOffset, tileWidth int32)

DecodeTileGfxData decodes tile graphics data for a slice of dt1 blocks

Types

type Block

type Block struct {
	X           int16
	Y           int16
	GridX       byte
	GridY       byte
	Format      BlockDataFormat
	EncodedData []byte
	Length      int32
	FileOffset  int32
}

Block represents a DT1 block

type BlockDataFormat

type BlockDataFormat int16

BlockDataFormat represents the format of the block data

const (
	// BlockFormatRLE specifies the block format is RLE encoded
	BlockFormatRLE BlockDataFormat = 0

	// BlockFormatIsometric specifies the block format isometrically encoded
	BlockFormatIsometric BlockDataFormat = 1
)

type DT1

type DT1 struct {
	Tiles []Tile
}

DT1 represents a DT1 file.

func LoadDT1

func LoadDT1(fileData []byte) (*DT1, error)

LoadDT1 loads a DT1 record

type MaterialFlags

type MaterialFlags struct {
	Other        bool
	Water        bool
	WoodObject   bool
	InsideStone  bool
	OutsideStone bool
	Dirt         bool
	Sand         bool
	Wood         bool
	Lava         bool
	Snow         bool
}

MaterialFlags represents the material flags. Lots of unknowns for now...

func NewMaterialFlags

func NewMaterialFlags(data uint16) MaterialFlags

NewMaterialFlags represents the material flags nolint:gomnd // Binary values

type SubTileFlags

type SubTileFlags struct {
	BlockWalk       bool
	BlockLOS        bool
	BlockJump       bool
	BlockPlayerWalk bool
	Unknown1        bool
	BlockLight      bool
	Unknown2        bool
	Unknown3        bool
}

SubTileFlags represent the sub-tile flags for a DT1

func NewSubTileFlags

func NewSubTileFlags(data byte) SubTileFlags

NewSubTileFlags returns a list of new subtile flags

func (*SubTileFlags) Combine

func (s *SubTileFlags) Combine(f SubTileFlags)

Combine combines a second set of flags into the current one

func (*SubTileFlags) DebugString

func (s *SubTileFlags) DebugString() string

DebugString returns the debug string

type Tile

type Tile struct {
	Direction        int32
	RoofHeight       int16
	MaterialFlags    MaterialFlags
	Height           int32
	Width            int32
	Type             int32
	Style            int32
	Sequence         int32
	RarityFrameIndex int32
	SubTileFlags     [25]SubTileFlags

	Blocks []Block
	// contains filtered or unexported fields
}

Tile is a representation of a map tile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL