data

package
v0.0.0-...-e78e2ff Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: BSD-3-Clause Imports: 10 Imported by: 13

Documentation

Index

Constants

View Source
const (
	// RenderType3D is for all three-dimensional objects.
	RenderType3D = ObjectRenderType(0x01)
	// RenderTypeSprite is for two-dimensional sprite-based objects.
	RenderTypeSprite = ObjectRenderType(0x02)
	// RenderTypeScreen is for animated content
	RenderTypeScreen = ObjectRenderType(0x03)
	// RenderTypeCritter is for enemies.
	RenderTypeCritter = ObjectRenderType(0x04)
	// RenderTypeFragment is for programs in cyberspace.
	RenderTypeFragment = ObjectRenderType(0x06)
	// RenderTypeInvisible is for infrastructure items (triggers, ...)
	RenderTypeInvisible = ObjectRenderType(0x07)
	// RenderTypeOrientedSurface is for items with a fixed orientation.
	RenderTypeOrientedSurface = ObjectRenderType(0x08)
	// RenderTypeSpecial require special handling for display.
	RenderTypeSpecial = ObjectRenderType(0x0B)
	// RenderTypeForceDoor is for semi-transparent barriers.
	RenderTypeForceDoor = ObjectRenderType(0x0C)
)
View Source
const (
	SlopeCeilingInverted = SlopeControl(0)
	SlopeCeilingMirrored = SlopeControl(1)
	SlopeCeilingFlat     = SlopeControl(2)
	SlopeFloorFlat       = SlopeControl(3)
)

Constants for the slope controls.

View Source
const (
	// TextureAnimationForward has the texture animation run in a linear loop.
	TextureAnimationForward = TextureAnimationLoopType(0x00)
	// TextureAnimationForthAndBack reverses the sequence at every end.
	TextureAnimationForthAndBack = TextureAnimationLoopType(0x01)
	// TextureAnimationBackAndForth reverses the sequence at every end.
	TextureAnimationBackAndForth = TextureAnimationLoopType(0x81)
)
View Source
const (
	// TileVisited specifies whether the tile has been seen.
	TileVisited TileFlag = 0x80000000

	// MusicIndexTileFlagMask is the mask for the music identifier.
	MusicIndexTileFlagMask = 0x0000F000

	// FloorShadowTileFlagMask is the mask for the floor shadow.
	FloorShadowTileFlagMask = 0x000F0000
	// CeilingShadowTileFlagMask is the mask for the ceiling shadow.
	CeilingShadowTileFlagMask = 0x0F000000
)
View Source
const GameStateSize int = 0x054D

GameStateSize specifies the byte count of a serialized GameState.

View Source
const LevelObjectChainStartIndex = LevelObjectChainIndex(0)

LevelObjectChainStartIndex is the table index of the start entry.

View Source
const LevelObjectCrossReferenceSize int = 10

LevelObjectCrossReferenceSize specifies the byte count of a serialized LevelObjectCrossReference.

View Source
const LevelObjectEntrySize int = 27

LevelObjectEntrySize specifies the byte count of a serialized LevelObjectEntry.

View Source
const LevelObjectPrefixSize int = 6

LevelObjectPrefixSize specifies the byte count of a serialized LevelObjectPrefix.

View Source
const LevelVariablesSize int = 0x5E

LevelVariablesSize specifies the byte count of a serialized LevelVariables.

View Source
const TimerEntrySize int = 8

TimerEntrySize is the number of bytes for one timer entry

View Source
const VideoClipSequenceBaseSize = 16

VideoClipSequenceBaseSize is the amount of bytes a sequence needs at least.

View Source
const VideoClipSequenceEndTag = int16(0x010C)

VideoClipSequenceEndTag is the constant for the last sequence field.

View Source
const VideoClipSequenceEntrySize = 5

VideoClipSequenceEntrySize is the amount of bytes a sequence entry has.

View Source
const VideoClipSequenceEntryTag = byte(0x04)

VideoClipSequenceEntryTag is the constant for the first member.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockPuzzleState

type BlockPuzzleState struct {
	// contains filtered or unexported fields
}

BlockPuzzleState describes the state of a block puzzle.

func NewBlockPuzzleState

func NewBlockPuzzleState(data []byte, height, width int) *BlockPuzzleState

NewBlockPuzzleState returns a new instance of a block puzzle state modifier. The returned instance works with the passed data slice directly.

func (*BlockPuzzleState) CellValue

func (state *BlockPuzzleState) CellValue(row, col int) int

CellValue returns the value of the identified cell.

func (*BlockPuzzleState) SetCellValue

func (state *BlockPuzzleState) SetCellValue(row, col int, value int)

SetCellValue sets the value of the identified cell.

type CommonObjectProperties

type CommonObjectProperties struct {
	Mass             uint16
	Unused0002       [2]byte
	DefaultHitpoints uint16
	Armor            uint8

	RenderType  ObjectRenderType
	PhysicsType uint8
	Bounciness  int8
	Unused000A  byte

	VerticalFrameOffset byte
	Unknown000C         [2]byte

	Vulnerabilities        byte
	SpecialVulnerabilities byte

	Unused0010        [2]byte
	Defence           byte
	ReceiveDamageFlag byte

	Flags      uint16
	ModelIndex uint16

	Unknown0018 byte

	Extra byte

	DestructionEffect byte
}

CommonObjectProperties describes properties every game object has.

type ElectronicMessage

type ElectronicMessage struct {
	// contains filtered or unexported fields
}

ElectronicMessage describes one message.

func DecodeElectronicMessage

func DecodeElectronicMessage(cp text.Codepage, provider chunk.BlockProvider) (message *ElectronicMessage, err error)

DecodeElectronicMessage tries to decode a message from given block holder.

func NewElectronicMessage

func NewElectronicMessage() *ElectronicMessage

NewElectronicMessage returns a new instance of an electronic message.

func (*ElectronicMessage) ColorIndex

func (message *ElectronicMessage) ColorIndex() int

ColorIndex returns the color index for the header text. -1 for default color.

func (*ElectronicMessage) Encode

func (message *ElectronicMessage) Encode(cp text.Codepage) *chunk.Chunk

Encode serializes the message into a block holder.

func (*ElectronicMessage) IsInterrupt

func (message *ElectronicMessage) IsInterrupt() bool

IsInterrupt returns true if this message is an interrupt of another.

func (*ElectronicMessage) LeftDisplay

func (message *ElectronicMessage) LeftDisplay() int

LeftDisplay returns the display index for the left side. -1 for no display.

func (*ElectronicMessage) NextMessage

func (message *ElectronicMessage) NextMessage() int

NextMessage returns the identifier of an interrupting message. Or -1 if no interrupt.

func (*ElectronicMessage) RightDisplay

func (message *ElectronicMessage) RightDisplay() int

RightDisplay returns the display index for the right side. -1 for no display.

func (*ElectronicMessage) Sender

func (message *ElectronicMessage) Sender() string

Sender returns the sender of the message.

func (*ElectronicMessage) SetColorIndex

func (message *ElectronicMessage) SetColorIndex(value int)

SetColorIndex sets the color index for the header text. -1 for default color.

func (*ElectronicMessage) SetInterrupt

func (message *ElectronicMessage) SetInterrupt(value bool)

SetInterrupt sets whether the message shall be an interrupting message.

func (*ElectronicMessage) SetLeftDisplay

func (message *ElectronicMessage) SetLeftDisplay(value int)

SetLeftDisplay sets the display index for the left side. -1 for no display.

func (*ElectronicMessage) SetNextMessage

func (message *ElectronicMessage) SetNextMessage(id int)

SetNextMessage sets the identifier of the interrupting message. -1 to have no interrupt.

func (*ElectronicMessage) SetRightDisplay

func (message *ElectronicMessage) SetRightDisplay(value int)

SetRightDisplay sets the display index for the right side. -1 for no display.

func (*ElectronicMessage) SetSender

func (message *ElectronicMessage) SetSender(value string)

SetSender sets the sender of the message.

func (*ElectronicMessage) SetSubject

func (message *ElectronicMessage) SetSubject(value string)

SetSubject sets the subject of the message.

func (*ElectronicMessage) SetTerseText

func (message *ElectronicMessage) SetTerseText(value string)

SetTerseText sets the terse text of the message.

func (*ElectronicMessage) SetTitle

func (message *ElectronicMessage) SetTitle(value string)

SetTitle sets the title of the message.

func (*ElectronicMessage) SetVerboseText

func (message *ElectronicMessage) SetVerboseText(value string)

SetVerboseText sets the verbose text of the message.

func (*ElectronicMessage) Subject

func (message *ElectronicMessage) Subject() string

Subject returns the subject of the message.

func (*ElectronicMessage) TerseText

func (message *ElectronicMessage) TerseText() string

TerseText returns the terse text of the message.

func (*ElectronicMessage) Title

func (message *ElectronicMessage) Title() string

Title returns the title of the message.

func (*ElectronicMessage) VerboseText

func (message *ElectronicMessage) VerboseText() string

VerboseText returns the verbose text of the message.

type GameState

type GameState struct {
	HackerName [20]byte

	Unknown0014 [1]byte

	CombatRating  byte
	MissionRating byte
	PuzzleRating  byte
	CyberRating   byte

	Unknown0019 [0x20]byte

	CurrentLevel byte

	Unknown003A [0x62]byte

	HackerHealth byte

	Unknown009D [0x483]byte

	HackerX     MapCoordinate
	Unknown0522 [2]byte
	HackerY     MapCoordinate
}

GameState contains the information about the hacker and any game related information.

func DefaultGameState

func DefaultGameState() *GameState

DefaultGameState returns a GameState instance with initialized default values.

func (*GameState) HackerNameString

func (data *GameState) HackerNameString() string

HackerNameString returns the name in string form

func (*GameState) String

func (data *GameState) String() string

type LevelInformation

type LevelInformation struct {
	Unknown0000 uint32
	Unknown0004 uint32
	Unknown0008 uint32
	Unknown000C uint32

	HeightShift uint32

	IgnoredPlaceholder uint32

	CyberspaceFlag uint32

	Unknown001C [9]byte

	TimerValue1 byte
	Unknown0026 [3]byte
	TimerCount  byte
	Unknown002A [3]byte
	TimerValue2 byte
	Unknown002E [12]byte
}

LevelInformation contains information about a single level.

func DefaultLevelInformation

func DefaultLevelInformation() *LevelInformation

DefaultLevelInformation returns an instance of LevelInformation with default values.

func (*LevelInformation) IsCyberspace

func (info *LevelInformation) IsCyberspace() bool

IsCyberspace returns true for cyberspace levels

func (*LevelInformation) String

func (info *LevelInformation) String() (result string)

type LevelObjectChainIndex

type LevelObjectChainIndex uint16

LevelObjectChainIndex describes an index into a chain of objects.

func (LevelObjectChainIndex) IsStart

func (index LevelObjectChainIndex) IsStart() bool

IsStart returns true if the index specifies the starting index.

type LevelObjectClassEntry

type LevelObjectClassEntry struct {
	LevelObjectPrefix
	// contains filtered or unexported fields
}

LevelObjectClassEntry is a basic entry for a class table, which contains the prefix header together with an arbitrary data block.

func NewLevelObjectClassEntry

func NewLevelObjectClassEntry(dataSize int) *LevelObjectClassEntry

NewLevelObjectClassEntry returns a new entry with the given amount as data size.

func (*LevelObjectClassEntry) Code

func (entry *LevelObjectClassEntry) Code(coder serial.Coder)

Code serializes the entry via the given coder.

func (*LevelObjectClassEntry) Data

func (entry *LevelObjectClassEntry) Data() []byte

Data returns a slice of the contained data.

type LevelObjectClassMeta

type LevelObjectClassMeta struct {
	EntrySize  int
	EntryCount int
}

LevelObjectClassMeta contains meta information about a level object class in an archive.

func LevelObjectClassMetaEntry

func LevelObjectClassMetaEntry(class res.ObjectClass) LevelObjectClassMeta

LevelObjectClassMetaEntry returns the meta entry for the corresponding object class.

type LevelObjectCrossReference

type LevelObjectCrossReference struct {
	TileX uint16
	TileY uint16

	LevelObjectTableIndex uint16

	NextObjectIndex uint16
	NextTileIndex   uint16
}

LevelObjectCrossReference describes the cross reference between one or more map tiles and level objects.

func DefaultLevelObjectCrossReference

func DefaultLevelObjectCrossReference() *LevelObjectCrossReference

DefaultLevelObjectCrossReference returns a new instance of LevelObjectCrossReference.

func (*LevelObjectCrossReference) String

func (ref *LevelObjectCrossReference) String() (result string)

type LevelObjectEntry

type LevelObjectEntry struct {
	InUse    byte
	Class    res.ObjectClass
	Subclass res.ObjectSubclass

	ClassTableIndex          uint16
	CrossReferenceTableIndex uint16
	Previous                 uint16
	Next                     uint16

	X    MapCoordinate
	Y    MapCoordinate
	Z    byte
	Rot1 byte
	Rot2 byte
	Rot3 byte

	Unknown0013 [1]byte

	Type      res.ObjectType
	Hitpoints uint16

	Extra [4]byte
}

LevelObjectEntry describes the basic information about a level object.

func DefaultLevelObjectEntry

func DefaultLevelObjectEntry() *LevelObjectEntry

DefaultLevelObjectEntry returns a new LevelObjectEntry instance.

func (*LevelObjectEntry) IsInUse

func (entry *LevelObjectEntry) IsInUse() bool

IsInUse returns true if the entry is active.

func (*LevelObjectEntry) NextIndex

func (entry *LevelObjectEntry) NextIndex() LevelObjectChainIndex

NextIndex returns the index of the next object.

func (*LevelObjectEntry) PreviousIndex

func (entry *LevelObjectEntry) PreviousIndex() LevelObjectChainIndex

PreviousIndex returns the index of the previous object.

func (*LevelObjectEntry) ReferenceIndex

func (entry *LevelObjectEntry) ReferenceIndex() LevelObjectChainIndex

ReferenceIndex returns the index of a referenced object.

func (*LevelObjectEntry) SetNextIndex

func (entry *LevelObjectEntry) SetNextIndex(index LevelObjectChainIndex)

SetNextIndex sets the index of the next object.

func (*LevelObjectEntry) SetPreviousIndex

func (entry *LevelObjectEntry) SetPreviousIndex(index LevelObjectChainIndex)

SetPreviousIndex sets the index of the previous object.

func (*LevelObjectEntry) SetReferenceIndex

func (entry *LevelObjectEntry) SetReferenceIndex(index LevelObjectChainIndex)

SetReferenceIndex sets the index of a referenced object.

func (*LevelObjectEntry) String

func (entry *LevelObjectEntry) String() (result string)

type LevelObjectPrefix

type LevelObjectPrefix struct {
	LevelObjectTableIndex uint16
	Previous              uint16
	Next                  uint16
}

LevelObjectPrefix contains the data every Level*Object has at the beginning.

func (*LevelObjectPrefix) NextIndex

func (prefix *LevelObjectPrefix) NextIndex() LevelObjectChainIndex

NextIndex returns the index of the next object.

func (*LevelObjectPrefix) PreviousIndex

func (prefix *LevelObjectPrefix) PreviousIndex() LevelObjectChainIndex

PreviousIndex returns the index of the previous object.

func (*LevelObjectPrefix) ReferenceIndex

func (prefix *LevelObjectPrefix) ReferenceIndex() LevelObjectChainIndex

ReferenceIndex returns the index of a referenced object.

func (*LevelObjectPrefix) SetNextIndex

func (prefix *LevelObjectPrefix) SetNextIndex(index LevelObjectChainIndex)

SetNextIndex sets the index of the next object.

func (*LevelObjectPrefix) SetPreviousIndex

func (prefix *LevelObjectPrefix) SetPreviousIndex(index LevelObjectChainIndex)

SetPreviousIndex sets the index of the previous object.

func (*LevelObjectPrefix) SetReferenceIndex

func (prefix *LevelObjectPrefix) SetReferenceIndex(index LevelObjectChainIndex)

SetReferenceIndex sets the index of a referenced object.

func (*LevelObjectPrefix) String

func (prefix *LevelObjectPrefix) String() (result string)

type LevelVariables

type LevelVariables struct {
	Size uint32

	Radiation         byte
	BioOrGravity      byte
	GravitySwitch     byte
	BioRegister       byte
	RadiationRegister byte

	Unknown0009 [85]byte
}

LevelVariables contains various variables about the level.

func NewLevelVariables

func NewLevelVariables() *LevelVariables

NewLevelVariables returns a new instance of level variables.

func (*LevelVariables) IsGravityModified

func (info *LevelVariables) IsGravityModified() bool

IsGravityModified returns true if gravity is non-standard 100%.

func (*LevelVariables) String

func (info *LevelVariables) String() (result string)

type MapCoordinate

type MapCoordinate uint16

MapCoordinate describes the position in one dimension on the tile map. It contains the tile number and an offset within the given tile.

func MapCoordinateOf

func MapCoordinateOf(tile byte, offset byte) MapCoordinate

MapCoordinateOf returns a map coordinate with the given values.

func (MapCoordinate) Offset

func (coord MapCoordinate) Offset() byte

Offset returns the offset within the tile for this coordinate.

func (MapCoordinate) String

func (coord MapCoordinate) String() (result string)

func (MapCoordinate) Tile

func (coord MapCoordinate) Tile() byte

Tile returns the tile number for this coordinate.

type ObjectRenderType

type ObjectRenderType byte

ObjectRenderType describes how an object should be visually represented.

type SlopeControl

type SlopeControl uint32

SlopeControl specifies how the floor and ceiling are affected for a sloped tile.

type String

type String struct {
	// contains filtered or unexported fields
}

String wraps an encoded string type.

func NewString

func NewString(length int) *String

NewString returns a new object prepared to hold given amount of bytes.

func (*String) Code

func (str *String) Code(coder serial.Coder)

Code serializes the string with given coder.

func (*String) String

func (str *String) String() string

type Table

type Table struct {
	Entries []interface{}
}

Table is a general container to keep a number of arbitrary entries.

func NewTable

func NewTable(entryCount int, factory func() interface{}) *Table

NewTable creates a new Table instance and initializes its entries to contain elements generated by provided factory function.

func (*Table) Code

func (table *Table) Code(coder serial.Coder)

Code serializes the entries of the table with the given coder.

func (*Table) Entry

func (table *Table) Entry(index int) interface{}

Entry returns the entry identified by given index.

func (*Table) Size

func (table *Table) Size() int

Size returns the amount of entries in the table.

func (*Table) String

func (table *Table) String() (result string)

type TextureAnimationEntry

type TextureAnimationEntry struct {
	FrameTime         uint16
	CurrentFrameTime  uint16
	CurrentFrameIndex byte
	FrameCount        byte
	LoopType          TextureAnimationLoopType
}

TextureAnimationEntry describes one entry of the texture animation table

type TextureAnimationLoopType

type TextureAnimationLoopType byte

TextureAnimationLoopType describes how a texture animation loop should advance.

type TileFlag

type TileFlag uint32

TileFlag describes simple properties of a map tile.

func (TileFlag) CeilingShadow

func (flag TileFlag) CeilingShadow() int

CeilingShadow returns the shadow value for the ceiling.

func (TileFlag) FloorShadow

func (flag TileFlag) FloorShadow() int

FloorShadow returns the shadow value for the floor.

func (TileFlag) MusicIndex

func (flag TileFlag) MusicIndex() int

MusicIndex returns the music identifier for the tile.

func (TileFlag) String

func (flag TileFlag) String() (result string)

func (TileFlag) WithCeilingShadow

func (flag TileFlag) WithCeilingShadow(value int) TileFlag

WithCeilingShadow returns a new flag combination having given shadow value.

func (TileFlag) WithFloorShadow

func (flag TileFlag) WithFloorShadow(value int) TileFlag

WithFloorShadow returns a new flag combination having given shadow value.

func (TileFlag) WithMusicIndex

func (flag TileFlag) WithMusicIndex(value int) TileFlag

WithMusicIndex returns a new flag combination having given music identifier.

type TileMapEntry

type TileMapEntry struct {
	Type             TileType
	Floor            byte
	Ceiling          byte
	SlopeHeight      byte
	FirstObjectIndex uint16
	Textures         TileTextureInfo
	Flags            TileFlag
	UnknownState     [4]byte
}

TileMapEntry describes one tile in the map.

func DefaultTileMapEntry

func DefaultTileMapEntry() *TileMapEntry

DefaultTileMapEntry returns a TileMapEntry instance with default values set.

func (*TileMapEntry) String

func (entry *TileMapEntry) String() (result string)

type TileTextureInfo

type TileTextureInfo uint16

TileTextureInfo describes the textures used for a map tile.

type TileType

type TileType byte

TileType describes the general type of a map tile.

const (
	Solid TileType = 0x00
	Open  TileType = 0x01

	DiagonalOpenSouthEast TileType = 0x02
	DiagonalOpenSouthWest TileType = 0x03
	DiagonalOpenNorthWest TileType = 0x04
	DiagonalOpenNorthEast TileType = 0x05

	SlopeSouthToNorth TileType = 0x06
	SlopeWestToEast   TileType = 0x07
	SlopeNorthToSouth TileType = 0x08
	SlopeEastToWest   TileType = 0x09

	ValleySouthEastToNorthWest TileType = 0x0A
	ValleySouthWestToNorthEast TileType = 0x0B
	ValleyNorthWestToSouthEast TileType = 0x0C
	ValleyNorthEastToSouthWest TileType = 0x0D

	RidgeNorthWestToSouthEast TileType = 0x0E
	RidgeNorthEastToSouthWest TileType = 0x0F
	RidgeSouthEastToNorthWest TileType = 0x10
	RidgeSouthWestToNorthEast TileType = 0x11
)

Tiles come in different forms: Solid tiles can not be entered, Open tiles are regular tiles with a flat floor and a flat ceiling. DiagonalOpen tiles are those with flat floors and ceilings, and two walls cut off by one diagonal wall. Slope tiles have a sloped floor (or ceiling). Valley tiles have one floor vertex lower while Ridge tiles have one floor vertex higher than the other three.

type TimerEntry

type TimerEntry struct {
	TriggerTime  uint16
	Unknown0002  uint16
	TargetObject uint16
	Unknown0006  uint16
}

TimerEntry describes one timer of a level.

type VideoClipSequence

type VideoClipSequence struct {
	Width       int16
	Height      int16
	FramesID    uint16
	Unknown0006 [6]byte
	IntroFlag   int16
	EndTag      int16

	Entries []*VideoClipSequenceEntry
}

VideoClipSequence describes a sequence of a low-res video.

func DefaultVideoClipSequence

func DefaultVideoClipSequence(entryCount int) *VideoClipSequence

DefaultVideoClipSequence returns a sequence instance with an initialized list of entries.

func (*VideoClipSequence) Code

func (sequence *VideoClipSequence) Code(coder serial.Coder)

Code serializes the sequence with the given coder.

func (*VideoClipSequence) String

func (sequence *VideoClipSequence) String() (result string)

type VideoClipSequenceEntry

type VideoClipSequenceEntry struct {
	Tag        byte
	FirstFrame byte
	LastFrame  byte
	FrameTime  uint16
}

VideoClipSequenceEntry describes an entry of a video clip sequence.

func DefaultVideoClipSequenceEntry

func DefaultVideoClipSequenceEntry() *VideoClipSequenceEntry

DefaultVideoClipSequenceEntry returns a new instance of an entry

func (*VideoClipSequenceEntry) String

func (entry *VideoClipSequenceEntry) String() (result string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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