maps

package
v0.0.0-...-16767da Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxHeight = 7   // Z coordinate
	MaxLength = 100 // Y coordinate
	MaxWidth  = 130 // X coordinate

	CellSize = 16 // seems to be

)

Variables

This section is empty.

Functions

func LoadGameMaps

func LoadGameMaps(dir string) (map[string]*GameMap, error)

Types

type Cell

type Cell struct {
	DoorAndCanisterRelated    byte `struc:"byte"`
	DoorLockAndReactorRelated byte `struc:"byte"`
	Unknown2                  byte `struc:"byte"`
	Surface                   ObjRef
	Left                      ObjRef
	Right                     ObjRef
	Center                    ObjRef
	Unknown11                 byte `struc:"byte"`
	Unknown12                 byte `struc:"byte"`
	Unknown13                 byte `struc:"byte"`
	Unknown14                 byte `struc:"byte"`
	SquadRelated              byte `struc:"byte"`
}

func (*Cell) At

func (c *Cell) At(n int) byte

type Character

type Character struct {
	Unknown1 []byte             `struc:"[178]byte"`
	Type     data.CharacterType `struc:"byte"`
	Name     string             `struc:"[80]byte"`

	// Attributes guessed by matching up numbers. Starts at 0x103
	WeaponSkill    int  `struc:"byte"`
	BallisticSkill int  `struc:"byte"`
	Unknown2       byte `struc:"byte"`
	Leadership     int  `struc:"byte"`
	Toughness      int  `struc:"byte"`
	Strength       int  `struc:"byte"`
	ActionPoints   int  `struc:"byte"`
	Unknown3       byte `struc:"byte"`
	Unknown4       byte `struc:"byte"`
	Health         int  `struc:"byte"`

	Unknown5    []byte `struc:"[91]byte"`
	Armor       int    `struc:"byte"`
	Unknown6    []byte `struc:"[84]byte"`
	YPos        int    `struc:"byte"` // These are actually much more complicated
	XPos        int    `struc:"byte"`
	Unknown7    []byte `struc:"[317]byte"`
	SquadNumber byte   `struc:"byte"`
	Unknown8    []byte `struc:"[895]byte"`
	Orientation byte   `struc:"byte"`
	Unknown9    []byte `struc:"[31]byte"`
}

func (*Character) String

func (c *Character) String() string

type Characters

type Characters []Character

type GameMap

type GameMap struct {
	// Main Header
	IsCampaignMap bool   `struc:"uint32"` // Tentatively: 0 = no, 1 = yes
	MinWidth      int    `struc:"uint32"`
	MinLength     int    `struc:"uint32"`
	MaxWidth      int    `struc:"uint32"`
	MaxLength     int    `struc:"uint32"`
	Unknown1      int    `struc:"uint32"`
	Unknown2      int    `struc:"uint32"`
	Unknown3      int    `struc:"uint32"`
	Unknown4      int    `struc:"uint32"`
	Magic         []byte `struc:"[8]byte"` // "\x08\x00WHMAP\x00"
	Unknown5      int    `struc:"uint32"`
	Unknown6      int    `struc:"uint32"`
	SetName       string `struc:"[8]byte"` // Links to a filename in `/Sets/*.set`
	Padding       []byte `struc:"[212]byte"`

	// Per-cell data
	NumCells int    `struc:"skip"` // FIXME: We can't use []Cell below without this field
	Cells    []Cell `struc:"[]Cell,sizefrom=NumCells"`

	// Trailer header
	Discard1 [3]byte `struc:"[3]byte"` // First byte is size of trailer header?

	TrailerMaxWidth  int `struc:"uint32"`
	TrailerMaxLength int `struc:"uint32"`
	TrailerMinWidth  int `struc:"uint32"`
	TrailerMinLength int `struc:"uint32"`

	NumCharacters int `struc:"uint32"`

	TrailerUnknown1 int `struc:"uint32"`
	TrailerUnknown2 int `struc:"uint16"`
	TrailerUnknown3 int `struc:"uint16"`
	TrailerUnknown4 int `struc:"uint32"`

	NumThingies     int    `struc:"byte"`
	TrailerUnknown5 []byte `struc:"[3]byte"`
	Padding1        []byte `struc:"[20]byte"`

	Characters []Character `struc:"[]Character,sizefrom=NumCharacters"`
	Thingies   []Thingy    `struc:"[]Thingy,sizefrom=NumThingies"`

	Title    string `struc:"[255]byte"`
	Briefing string `struc:"[2048]byte"`

	// Maybe? each contains either 0 or 1? Hard to say
	TrailerUnknown6 []byte `struc:"[85]byte"`
}

func LoadGameMap

func LoadGameMap(prefix string) (*GameMap, error)

A game map contains a .txt and a .map. If they're in the same directory, just pass the directory + basename to load both

func LoadGameMapByFiles

func LoadGameMapByFiles(mapFile, txtFile string) (*GameMap, error)

A game map is composed of two files: .map and .txt. We ignore the text file, since the content is replicated in the map file.

func (*GameMap) At

func (g *GameMap) At(x, y, z int) *Cell

func (*GameMap) Check

func (g *GameMap) Check() error

func (*GameMap) MapSetFilename

func (g *GameMap) MapSetFilename() string

func (*GameMap) MapSetName

func (g *GameMap) MapSetName() string

func (*GameMap) Rect

func (m *GameMap) Rect() image.Rectangle

type ObjRef

type ObjRef struct {
	AreaByte          byte `struc:"byte"`
	SpriteAndFlagByte byte `struc:"byte"`
}

func (*ObjRef) Index

func (o *ObjRef) Index() int

The index into a set palette to retrieve the object

func (ObjRef) IsActive

func (o ObjRef) IsActive() bool

The top bit seems to say whether we should draw or not.

func (*ObjRef) Sprite

func (o *ObjRef) Sprite() int

type Thingies

type Thingies []Thingy

type Thingy

type Thingy struct {
	Unknown1 int `struc:"uint32"`
}

TODO. These are triggers/reactors/etc.

Jump to

Keyboard shortcuts

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