d2dt1

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 3 Imported by: 3

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

	EncodedData []byte
	Length      int32
	FileOffset  int32
	// contains filtered or unexported fields
}

Block represents a DT1 block

func (*Block) Format

func (b *Block) Format() BlockDataFormat

Format returns block format

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
	// contains filtered or unexported fields
}

DT1 represents a DT1 file.

func LoadDT1

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

LoadDT1 loads a DT1 record

func New

func New() *DT1

New creates a new DT1

func (*DT1) Marshal

func (d *DT1) Marshal() []byte

Marshal encodes dt1 data back to byte slice

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

func (*MaterialFlags) Encode

func (m *MaterialFlags) Encode() uint16

Encode encodes MaterialFlags back to uint16

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

func (*SubTileFlags) Encode

func (s *SubTileFlags) Encode() byte

Encode encodes SubTileFlags back to byte

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