wad2

package
v0.0.0-...-1d919a4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LT_RAW     int8 = 0x40
	LT_PICTURE int8 = 0x42
	LT_MIPTEX  int8 = 0x44
)

Functions

func MIPName

func MIPName(lumpName string) [16]byte

func PalettedImageToQuakePic

func PalettedImageToQuakePic(img *image.Paletted) ([]byte, error)

func RGBAImageToMIPTexture

func RGBAImageToMIPTexture(img *image.RGBA, lumpName string) ([]byte, error)

Types

type Lump

type Lump struct {
	Name string
	Type int8
	Data []byte
}

type LumpHeader

type LumpHeader struct {
	FilePos     int32
	Size        int32
	MemSize     int32
	Type        int8
	Compression int8
	Dummy       int16
	Name        [16]byte
}

func (*LumpHeader) NameString

func (l *LumpHeader) NameString() string

type MIPTexture

type MIPTexture struct {
	Name      [16]byte
	Width     int32
	Height    int32
	Scale1Pos int32 // pos to 1:1 data
	Scale2Pos int32 // pos to data scaled to half
	Scale4Pos int32 // pos to data scaled to 1/4
	Scale8Pos int32 // pos to data scaled to 1/8
}

type QKPicHeader

type QKPicHeader struct {
	Width      uint16
	Height     uint16
	LeftOffset int16
	TopOffset  int16
}

type WAD2Entry

type WAD2Entry struct {
	Header   *LumpHeader
	Reader   *WAD2Reader
	LumpName string
}

func NewWAD2Entry

func NewWAD2Entry(name string, header *LumpHeader, reader *WAD2Reader) *WAD2Entry

func (*WAD2Entry) GuessFileTypeAndSubdir

func (w *WAD2Entry) GuessFileTypeAndSubdir() (string, string)

func (*WAD2Entry) Name

func (w *WAD2Entry) Name() string

func (*WAD2Entry) Open

func (w *WAD2Entry) Open() (io.Reader, error)

func (*WAD2Entry) Print

func (w *WAD2Entry) Print()

func (*WAD2Entry) Size

func (w *WAD2Entry) Size() int

type WAD2Header

type WAD2Header struct {
	Magic      [4]byte
	NumEntries int32
	DirOffset  int32
}

type WAD2Iterator

type WAD2Iterator struct {
	Reader *WAD2Reader
	// contains filtered or unexported fields
}

func (*WAD2Iterator) Next

func (w *WAD2Iterator) Next() lumps.ArchiveEntry

type WAD2Reader

type WAD2Reader struct {
	Header          WAD2Header
	Directory       []LumpHeader
	DirectoryByName map[string]int
	// contains filtered or unexported fields
}

func NewWAD2Reader

func NewWAD2Reader(fhnd io.ReadSeeker) (*WAD2Reader, error)

func (*WAD2Reader) GetEntry

func (w *WAD2Reader) GetEntry(name string) (lumps.ArchiveEntry, error)

func (*WAD2Reader) List

func (w *WAD2Reader) List() lumps.ArchiveIterator

func (*WAD2Reader) Type

func (w *WAD2Reader) Type() string

type WADWriter

type WADWriter struct {
	Directory []Lump
}

func NewWADWriter

func NewWADWriter() (*WADWriter, error)

func (*WADWriter) AddLump

func (w *WADWriter) AddLump(name string, data []byte, ltype int8) error

func (*WADWriter) Write

func (w *WADWriter) Write(dest io.WriteSeeker) (int64, error)

Jump to

Keyboard shortcuts

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