wadmake

package module
v0.0.0-...-e4d2f79 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2016 License: AGPL-3.0 Imports: 8 Imported by: 1

README

WADmake

A utility for creating WAD, ZIP (PK3) and 7Z (PK7) archives for Doom.

FAQ

Q: Why?

A: Because deutex needed to be put out of its misery.

Q: Why not SLADE/XWE?

A: SLADE operates on a single monolithic file, which cannot be version-controlled in a useful fashion. Revision control has been standard practice in the software field for at least a decade, and the benefits of using revision control software are too numerous to list here.

Q: Why not use zip/7za in a shell script or makefile?

A: WADmake is designed to work with Doom-specific file formats natively.

Q: Why not several dozen single-use utilities?

A: Because I wanted the utility to be a single executable that you could copy around freely and drop into a project, like deutex. Of course, there are still some operations that require third party utilities, but such utilities are optional if you do not require their functionality.

Q: Why Go?

A: Again, because I wanted the utility to be a single executable. Go is incredibly good at producing a single statically linked executable. A prior version of WADmake was written in C++, but I switched since Go is so much easier to maintain.

Q: Why Lua?

A: A build system should be extensible, and I did not want to invent a new extension language from scratch. In addition to its small size and ubiquity as an extension language, Lua seemed like a natrual fit as it originated as a configuration language and has been used in other build systems like Premake.

License

Currently GNU AGPLv3. If there is a compelling case to be made for a more permissive license, I am open to suggestions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, wad *Wad) error

Encode encodes the passed Wad structure into WAD file data.

func LuaDebugStack

func LuaDebugStack(state *lua.State)

LuaDebugStack outputs the top of the stack and the contents of every location in the stack. This is purely a debugging tool.

func NewLuaEnvironment

func NewLuaEnvironment() *lua.State

NewLuaEnvironment creates a new lua.State with all standard libraries available, in addition to the wad library.

func WadLumpsOpen

func WadLumpsOpen(l *lua.State) error

WadLumpsOpen adds all lump-related functions to the table located at the top of the stack of the pased lua state.

Types

type Directory

type Directory []Lump

Directory is an ordered array of Lumps.

func (*Directory) Search

func (dir *Directory) Search(name string, start int) (int, bool)

Search searches for a specific lump by name and returns its position and true if found, or zero and false if not found.

type Lump

type Lump struct {
	Name string
	Data []byte
}

Lump is a filename and associated data located in a WAD or ZIP file.

type Wad

type Wad struct {
	WadType WadType
	Lumps   Directory
}

Wad is a stucture that contains all the data necessary to marshall a WAD file.

func Decode

func Decode(r io.ReadSeeker) (*Wad, error)

Decode decodes WAD file data passed into the reader into a Wad structure.

func NewWad

func NewWad(wadType WadType) *Wad

NewWad creates a new Wad structure.

type WadType

type WadType int

WadType designates the type of WAD file a WAD is.

const (
	// WadTypeIWAD designates an IWAD, a WAD file that is considered
	// the primary resource file for the game.
	WadTypeIWAD WadType = iota

	// WadTypePWAD designates a PWAD, or a WAD file that is "patched"
	// on top of other resources.
	WadTypePWAD
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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