Documentation ¶
Index ¶
- Constants
- func EmptyLevelData(param EmptyLevelParameters) [lvlids.PerLevel][]byte
- type BaseInfo
- type BlockPuzzleState
- type CeilingInfo
- func (info CeilingInfo) AbsoluteHeight() TileHeightUnit
- func (info CeilingInfo) HasHazard() bool
- func (info CeilingInfo) TextureRotations() int
- func (info CeilingInfo) WithAbsoluteHeight(value TileHeightUnit) CeilingInfo
- func (info CeilingInfo) WithHazard(value bool) CeilingInfo
- func (info CeilingInfo) WithTextureRotations(value int) CeilingInfo
- type Coordinate
- type CyberspaceFlag
- func (flag CyberspaceFlag) AsTileFlag() TileFlag
- func (flag CyberspaceFlag) FlightPull() CyberspaceFlightPull
- func (flag CyberspaceFlag) GameOfLifeState() int
- func (flag CyberspaceFlag) WithFlightPull(value CyberspaceFlightPull) CyberspaceFlag
- func (flag CyberspaceFlag) WithGameOfLifeState(value int) CyberspaceFlag
- type CyberspaceFlightPull
- type Direction
- type DirectionMask
- type EmptyLevelParameters
- type FloorInfo
- func (info FloorInfo) AbsoluteHeight() TileHeightUnit
- func (info FloorInfo) HasHazard() bool
- func (info FloorInfo) TextureRotations() int
- func (info FloorInfo) WithAbsoluteHeight(value TileHeightUnit) FloorInfo
- func (info FloorInfo) WithHazard(value bool) FloorInfo
- func (info FloorInfo) WithTextureRotations(value int) FloorInfo
- type HeightSemaphores
- type HeightShift
- type HeightUnit
- type Level
- func (lvl *Level) DelObject(id ObjectID)
- func (lvl *Level) EncodeState() [lvlids.PerLevel][]byte
- func (lvl *Level) ForEachObject(handler func(ObjectID, ObjectMasterEntry))
- func (lvl *Level) ID() int
- func (lvl *Level) InvalidateResources(ids []resource.ID)
- func (lvl *Level) IsCyberspace() bool
- func (lvl *Level) MapGridInfo(x, y int) (TileType, TileSlopeControl, WallHeights)
- func (lvl *Level) NewObject(class object.Class) (ObjectID, error)
- func (lvl *Level) Object(id ObjectID) *ObjectMasterEntry
- func (lvl *Level) ObjectClassData(id ObjectID) []byte
- func (lvl *Level) ObjectClassStats(class object.Class) (active, limit int)
- func (lvl *Level) ObjectLimit() ObjectID
- func (lvl *Level) Parameters() *Parameters
- func (lvl *Level) SetHeightShift(value HeightShift)
- func (lvl *Level) SetSurveillanceSource(index int, id ObjectID)
- func (lvl *Level) SetSurveillanceSurrogate(index int, id ObjectID)
- func (lvl *Level) SetTextureAtlasEntry(index int, textureIndex TextureIndex)
- func (lvl *Level) Size() (x, y int, z HeightShift)
- func (lvl *Level) SurveillanceSources() [SurveillanceObjectCount]ObjectID
- func (lvl *Level) SurveillanceSurrogates() [SurveillanceObjectCount]ObjectID
- func (lvl *Level) TextureAnimations() []TextureAnimationEntry
- func (lvl *Level) TextureAtlas() TextureAtlas
- func (lvl *Level) Tile(x, y int) *TileMapEntry
- func (lvl *Level) UpdateObjectLocation(id ObjectID)
- type MapNotesPointer
- type ObjectClassEntry
- type ObjectClassInfo
- type ObjectClassTable
- type ObjectCrossReferenceEntry
- type ObjectCrossReferenceTable
- type ObjectID
- type ObjectMasterEntry
- type ObjectMasterTable
- type Parameters
- type RealWorldFlag
- func (flag RealWorldFlag) AsTileFlag() TileFlag
- func (flag RealWorldFlag) CeilingShadow() int
- func (flag RealWorldFlag) Deconstructed() bool
- func (flag RealWorldFlag) FloorShadow() int
- func (flag RealWorldFlag) TileVisited() bool
- func (flag RealWorldFlag) UseAdjacentWallTexture() bool
- func (flag RealWorldFlag) WallTextureOffset() TileHeightUnit
- func (flag RealWorldFlag) WallTexturePattern() WallTexturePattern
- func (flag RealWorldFlag) WithCeilingShadow(value int) RealWorldFlag
- func (flag RealWorldFlag) WithDeconstructed(value bool) RealWorldFlag
- func (flag RealWorldFlag) WithFloorShadow(value int) RealWorldFlag
- func (flag RealWorldFlag) WithTileVisited(value bool) RealWorldFlag
- func (flag RealWorldFlag) WithUseAdjacentWallTexture(value bool) RealWorldFlag
- func (flag RealWorldFlag) WithWallTextureOffset(value TileHeightUnit) RealWorldFlag
- func (flag RealWorldFlag) WithWallTexturePattern(value WallTexturePattern) RealWorldFlag
- type RotationUnit
- type SchedulerInfo
- type SlopeFactors
- type TextureAnimationEntry
- type TextureAnimationLoopType
- type TextureAtlas
- type TextureIndex
- type TileFlag
- func (flag TileFlag) ForCyberspace() CyberspaceFlag
- func (flag TileFlag) ForRealWorld() RealWorldFlag
- func (flag TileFlag) MusicIndex() int
- func (flag TileFlag) SlopeControl() TileSlopeControl
- func (flag TileFlag) WithMusicIndex(value int) TileFlag
- func (flag TileFlag) WithSlopeControl(ctrl TileSlopeControl) TileFlag
- type TileHeightUnit
- type TileMap
- type TileMapEntry
- type TileSlopeControl
- type TileTextureInfo
- func (info TileTextureInfo) CeilingPaletteIndex() byte
- func (info TileTextureInfo) CeilingTextureIndex() int
- func (info TileTextureInfo) FloorPaletteIndex() byte
- func (info TileTextureInfo) FloorTextureIndex() int
- func (info TileTextureInfo) WallTextureIndex() int
- func (info TileTextureInfo) WithCeilingPaletteIndex(value byte) TileTextureInfo
- func (info TileTextureInfo) WithCeilingTextureIndex(value int) TileTextureInfo
- func (info TileTextureInfo) WithFloorPaletteIndex(value byte) TileTextureInfo
- func (info TileTextureInfo) WithFloorTextureIndex(value int) TileTextureInfo
- func (info TileTextureInfo) WithWallTextureIndex(value int) TileTextureInfo
- type TileType
- type TileTypeInfo
- type UnknownL41
- type UnknownL48
- type UnknownL49
- type UnknownL50
- type UnknownL52
- type WallHeights
- type WallHeightsMap
- type WallTexturePattern
Constants ¶
const ( // MapVersion is the version of the map structures. MapVersion int32 = 11 // ObjectVersion is the version of object structures. ObjectVersion int32 = 27 // SavefileVersion is the version of the save. SavefileVersion int32 = 13 )
const ( // LoopConfigEntryCount describes how many loop entries a level has. LoopConfigEntryCount = 64 // LoopConfigEntrySize describes the size, in bytes, of a loop config entry. LoopConfigEntrySize = 15 )
const ( // TextureAnimationCount describes how many entries of texture animations a level can have. TextureAnimationCount = 4 // TextureAnimationEntrySize is the size, in bytes, of one animation entry. TextureAnimationEntrySize = 7 )
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) )
const ( // DefaultTextureAtlasSize is the amount of textures a level can hold. DefaultTextureAtlasSize = 54 // FloorCeilingTextureLimit describes the amount of textures available for floors/ceilings. FloorCeilingTextureLimit = 32 )
const (
// MapNotesSize is the size, in bytes, of the map notes resource.
MapNotesSize = 0x0800
)
const (
// ObjectClassEntryHeaderSize is the size, in bytes, of the header prefix for each class entry.
ObjectClassEntryHeaderSize = 6
)
const (
// ObjectCrossReferenceEntrySize describes the size, in bytes, of a ObjectCrossReferenceEntry.
ObjectCrossReferenceEntrySize = 10
)
const (
// ObjectMasterEntrySize describes the size, in bytes, of a ObjectMasterEntry.
ObjectMasterEntrySize = 27
)
const (
// ParametersSize is the serialized size, in bytes, of the Parameters structure.
ParametersSize = 94
)
const (
// SurveillanceObjectCount describes how many surveillance objects a level can have.
SurveillanceObjectCount = 8
)
Variables ¶
This section is empty.
Functions ¶
func EmptyLevelData ¶
func EmptyLevelData(param EmptyLevelParameters) [lvlids.PerLevel][]byte
EmptyLevelData returns an array of serialized data for an empty level.
Types ¶
type BaseInfo ¶
type BaseInfo struct { // XSize is the horizontal extent of the map (West to East). XSize int32 // YSize is the vertical extent of the map (South to North). YSize int32 // XShift is the base value of XSize (XSize == 1 << XShift). XShift int32 // YShift is the base value of YSize (YSize == 1 << YShift). YShift int32 // ZShift is the base value of the height of the map. ZShift HeightShift // Cyberspace indicates whether the level is cyberspace. Cyberspace byte // Scheduler contains base information about the schedule table of the level. Scheduler SchedulerInfo // contains filtered or unexported fields }
BaseInfo describes the basic parameters of a level map.
func DefaultBaseInfo ¶
DefaultBaseInfo returns an initialized instance.
type BlockPuzzleState ¶ added in v0.4.0
type BlockPuzzleState struct {
// contains filtered or unexported fields
}
BlockPuzzleState describes the state of a block puzzle.
func NewBlockPuzzleState ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (state *BlockPuzzleState) CellValue(row, col int) int
CellValue returns the value of the identified cell.
func (*BlockPuzzleState) SetCellValue ¶ added in v0.4.0
func (state *BlockPuzzleState) SetCellValue(row, col int, value int)
SetCellValue sets the value of the identified cell.
type CeilingInfo ¶
type CeilingInfo byte
CeilingInfo describes the properties of a ceiling
func (CeilingInfo) AbsoluteHeight ¶
func (info CeilingInfo) AbsoluteHeight() TileHeightUnit
AbsoluteHeight returns the height (from minimum floor height zero) of the ceiling. Internally, this value is stored "from maximum ceiling height 32" down. The range is [1..TileHeightUnitMax].
func (CeilingInfo) HasHazard ¶
func (info CeilingInfo) HasHazard() bool
HasHazard returns true if the hazard flag is set.
func (CeilingInfo) TextureRotations ¶
func (info CeilingInfo) TextureRotations() int
TextureRotations returns the rotation steps to apply for the ceiling texture. Valid range: [0..3].
func (CeilingInfo) WithAbsoluteHeight ¶
func (info CeilingInfo) WithAbsoluteHeight(value TileHeightUnit) CeilingInfo
WithAbsoluteHeight returns a ceiling info that specifies the given absolute height. Internally, this value is stored "from maximum ceiling height 32" down. The allowed range is [1..TileHeightUnitMax].
func (CeilingInfo) WithHazard ¶
func (info CeilingInfo) WithHazard(value bool) CeilingInfo
WithHazard returns a ceiling info with the hazard flag set according to given value.
func (CeilingInfo) WithTextureRotations ¶
func (info CeilingInfo) WithTextureRotations(value int) CeilingInfo
WithTextureRotations returns a ceiling info that specifies the given the rotation steps. The provided value is normalized to the valid range.
type Coordinate ¶
type Coordinate uint16
Coordinate describes a tile position in one dimension.
func CoordinateAt ¶
func CoordinateAt(tile, fine byte) Coordinate
CoordinateAt returns a coordinate with given parameters.
func (Coordinate) Fine ¶
func (coord Coordinate) Fine() byte
Fine returns the fine part of the coordinate.
func (Coordinate) Tile ¶
func (coord Coordinate) Tile() byte
Tile returns the tile part of the coordinate.
type CyberspaceFlag ¶
type CyberspaceFlag TileFlag
CyberspaceFlag describes simple properties of a map tile in cyberspace.
func (CyberspaceFlag) AsTileFlag ¶
func (flag CyberspaceFlag) AsTileFlag() TileFlag
AsTileFlag returns the flags as regular tile flag value.
func (CyberspaceFlag) FlightPull ¶
func (flag CyberspaceFlag) FlightPull() CyberspaceFlightPull
FlightPull returns the pull applying in a tile.
func (CyberspaceFlag) GameOfLifeState ¶
func (flag CyberspaceFlag) GameOfLifeState() int
GameOfLifeState returns the current game-of-life state.
func (CyberspaceFlag) WithFlightPull ¶
func (flag CyberspaceFlag) WithFlightPull(value CyberspaceFlightPull) CyberspaceFlag
WithFlightPull returns a flag instance with the given pull applied.
func (CyberspaceFlag) WithGameOfLifeState ¶
func (flag CyberspaceFlag) WithGameOfLifeState(value int) CyberspaceFlag
WithGameOfLifeState returns a flag with the given game-of-life state set.
type CyberspaceFlightPull ¶
type CyberspaceFlightPull byte
CyberspaceFlightPull describes a directed pull of hacker in cyberspace.
const ( CyberspaceFlightPullNone CyberspaceFlightPull = 0 CyberspaceFlightPullWeakEast CyberspaceFlightPull = 1 CyberspaceFlightPullWeakWest CyberspaceFlightPull = 2 CyberspaceFlightPullWeakNorth CyberspaceFlightPull = 3 CyberspaceFlightPullWeakSouth CyberspaceFlightPull = 4 CyberspaceFlightPullMediumEast CyberspaceFlightPull = 5 CyberspaceFlightPullMediumWest CyberspaceFlightPull = 6 CyberspaceFlightPullMediumNorth CyberspaceFlightPull = 7 CyberspaceFlightPullMediumSouth CyberspaceFlightPull = 8 CyberspaceFlightPullStrongEast CyberspaceFlightPull = 9 CyberspaceFlightPullStrongWest CyberspaceFlightPull = 10 CyberspaceFlightPullStrongNorth CyberspaceFlightPull = 11 CyberspaceFlightPullStrongSouth CyberspaceFlightPull = 12 CyberspaceFlightPullMediumCeiling CyberspaceFlightPull = 13 CyberspaceFlightPullMediumFloor CyberspaceFlightPull = 14 CyberspaceFlightPullStrongCeiling CyberspaceFlightPull = 15 CyberspaceFlightPullStrongFloor CyberspaceFlightPull = 16 )
CyberspaceFlightPull constants
func CyberspaceFlightPulls ¶
func CyberspaceFlightPulls() []CyberspaceFlightPull
CyberspaceFlightPulls returns all constants of CyberspaceFlightPull.
func (CyberspaceFlightPull) String ¶
func (pull CyberspaceFlightPull) String() string
String returns a textual representation.
type Direction ¶
type Direction byte
Direction is an enumeration of cardinal and ordinal directions. Cardinal directions describe sides, ordinal directions describe corners.
const ( DirNorth Direction = iota DirNorthEast DirEast DirSouthEast DirSouth DirSouthWest DirWest DirNorthWest )
Direction constants
func (Direction) AsMask ¶
func (dir Direction) AsMask() DirectionMask
AsMask returns the direction as a mask
func (Direction) Offset ¶
Offset returns a direction that you reach by offsetting this one by the given value. The direction goes in a circle, and both positive and negative offsets are allowed.
func (Direction) Plus ¶
func (dir Direction) Plus(other Direction) DirectionMask
Plus is a shortcut for dir.AsMask().Plus(other).
type DirectionMask ¶
type DirectionMask byte
DirectionMask is a bitfield combination of directions.
func (DirectionMask) Plus ¶
func (mask DirectionMask) Plus(dir Direction) DirectionMask
Plus adds the mask of the given direction to this mask and returns the result.
type EmptyLevelParameters ¶
type EmptyLevelParameters struct { // Cyberspace indicates whether the level should be marked as cyberspace. Cyberspace bool // MapModifier is called to make initial changes to the map before serializing. // Can be used to empty out starter tile on level 1. MapModifier func(TileMap) }
EmptyLevelParameters contain the values to create an empty level
type FloorInfo ¶
type FloorInfo byte
FloorInfo describes the properties of a floor
func (FloorInfo) AbsoluteHeight ¶
func (info FloorInfo) AbsoluteHeight() TileHeightUnit
AbsoluteHeight returns the floor height in range of [0..TileHeightUnitMax-1].
func (FloorInfo) TextureRotations ¶
TextureRotations returns the rotation steps to apply for the floor texture. Valid range: [0..3].
func (FloorInfo) WithAbsoluteHeight ¶
func (info FloorInfo) WithAbsoluteHeight(value TileHeightUnit) FloorInfo
WithAbsoluteHeight returns a floor info that specifies the given absolute height. The allowed range is [0..TileHeightUnitMax-1].
func (FloorInfo) WithHazard ¶
WithHazard returns a floor info with the hazard flag set according to given value.
func (FloorInfo) WithTextureRotations ¶
WithTextureRotations returns a floor info that specifies the given the rotation steps. The provided value is normalized to the valid range.
type HeightSemaphores ¶
type HeightSemaphores [0x40]byte
HeightSemaphores is a placeholder for storing height transitions.
type HeightShift ¶
type HeightShift int32
HeightShift indicates the vertical scale of a level.
func (HeightShift) ValueFromObjectHeight ¶ added in v0.4.0
func (shift HeightShift) ValueFromObjectHeight(raw HeightUnit) (float32, error)
ValueFromObjectHeight returns a floating point value in tiles based on an object height.
func (HeightShift) ValueFromTileHeight ¶
func (shift HeightShift) ValueFromTileHeight(raw TileHeightUnit) (float32, error)
ValueFromTileHeight returns a floating point value in tiles based on a tile height.
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
Level is the complete structure defining all necessary data for a level.
func (*Level) EncodeState ¶
EncodeState returns a subset of encoded level data, which only includes data that is loaded (modified) by the level structure. For any data block that is not relevant, a zero length slice is returned.
func (*Level) ForEachObject ¶ added in v0.4.0
func (lvl *Level) ForEachObject(handler func(ObjectID, ObjectMasterEntry))
ForEachObject iterates over all active objects and calls the given handler.
func (*Level) InvalidateResources ¶
InvalidateResources resets all internally cached data.
func (*Level) IsCyberspace ¶
IsCyberspace returns true if the level describes a cyberspace.
func (*Level) MapGridInfo ¶
func (lvl *Level) MapGridInfo(x, y int) (TileType, TileSlopeControl, WallHeights)
MapGridInfo returns the information necessary to draw a 2D map.
func (*Level) NewObject ¶ added in v0.4.0
NewObject attempts to allocate a new object for given class. The created object has no place in the world and must be placed. Returns 0 and an error if not possible.
func (*Level) Object ¶ added in v0.4.0
func (lvl *Level) Object(id ObjectID) *ObjectMasterEntry
Object returns the master entry for the identified object.
func (*Level) ObjectClassData ¶ added in v0.4.0
ObjectClassData returns the raw class data for the given object.
func (*Level) ObjectClassStats ¶ added in v0.4.0
ObjectClassStats returns the number of used and totoal possible entries of given class.
func (*Level) ObjectLimit ¶
ObjectLimit returns the highest object ID that can be stored in this level.
func (*Level) Parameters ¶
func (lvl *Level) Parameters() *Parameters
Parameters returns the extra properties the level has.
func (*Level) SetHeightShift ¶
func (lvl *Level) SetHeightShift(value HeightShift)
SetHeightShift changes the vertical scale of the level.
func (*Level) SetSurveillanceSource ¶
SetSurveillanceSource sets a surveillance source.
func (*Level) SetSurveillanceSurrogate ¶
SetSurveillanceSurrogate sets a surveillance source.
func (*Level) SetTextureAtlasEntry ¶
func (lvl *Level) SetTextureAtlasEntry(index int, textureIndex TextureIndex)
SetTextureAtlasEntry changes the entry of the atlas.
func (*Level) Size ¶
func (lvl *Level) Size() (x, y int, z HeightShift)
Size returns the dimensions of the level.
func (*Level) SurveillanceSources ¶
func (lvl *Level) SurveillanceSources() [SurveillanceObjectCount]ObjectID
SurveillanceSources returns the current sources of surveillance.
func (*Level) SurveillanceSurrogates ¶
func (lvl *Level) SurveillanceSurrogates() [SurveillanceObjectCount]ObjectID
SurveillanceSurrogates returns the current surrogates of surveillance.
func (*Level) TextureAnimations ¶
func (lvl *Level) TextureAnimations() []TextureAnimationEntry
TextureAnimations returns the list of animations.
func (*Level) TextureAtlas ¶
func (lvl *Level) TextureAtlas() TextureAtlas
TextureAtlas returns the atlas for textures.
func (*Level) Tile ¶
func (lvl *Level) Tile(x, y int) *TileMapEntry
Tile returns the tile entry at given position.
func (*Level) UpdateObjectLocation ¶ added in v0.4.0
UpdateObjectLocation updates the reference table between object and tiles based on its current location.
type MapNotesPointer ¶
type MapNotesPointer uint32
MapNotesPointer is an offset into the map notes resource.
type ObjectClassEntry ¶
ObjectClassEntry describes an entry in a object-class specific list.
func NewObjectClassEntry ¶
func NewObjectClassEntry(dataSize int) *ObjectClassEntry
NewObjectClassEntry returns an instance with the given amount of bytes initialized for data.
func (*ObjectClassEntry) Code ¶
func (entry *ObjectClassEntry) Code(coder serial.Coder)
Code serializes the entry with given coder, including the data array.
func (*ObjectClassEntry) Reset ¶
func (entry *ObjectClassEntry) Reset()
Reset sets all members of the entry to zero, including all bytes of the data array.
type ObjectClassInfo ¶
ObjectClassInfo contains meta information about a level object class in an archive.
func ObjectClassInfoFor ¶
func ObjectClassInfoFor(class object.Class) ObjectClassInfo
ObjectClassInfoFor returns the info entry for the corresponding object class.
type ObjectClassTable ¶
type ObjectClassTable []ObjectClassEntry
ObjectClassTable is a list of entries.
The first entry is reserved for internal use. For the reserved entry, the Next field identifies the head of the single-linked free chain, and the ObjectID field identifies the head of the double-linked used chain.
func DefaultObjectClassTable ¶
func DefaultObjectClassTable(class object.Class) ObjectClassTable
DefaultObjectClassTable returns an initialized table for given object class.
func (ObjectClassTable) Allocate ¶ added in v0.4.0
func (table ObjectClassTable) Allocate() int
Allocate attempts to reserve an entry in the table and returns the corresponding index. returns 0 if exhausted.
func (ObjectClassTable) AllocateData ¶
func (table ObjectClassTable) AllocateData(size int)
AllocateData prepares each entry to be able to store the given amount of bytes. This function drops any previously assigned data.
func (ObjectClassTable) Code ¶
func (table ObjectClassTable) Code(coder serial.Coder)
Code serializes the table with the provided coder.
func (ObjectClassTable) Release ¶ added in v0.4.0
func (table ObjectClassTable) Release(index int)
Release frees the identified entry.
func (ObjectClassTable) Reset ¶
func (table ObjectClassTable) Reset()
Reset wipes the entire table and initializes all links. The bytes of the data members of each entry are reset to zero.
type ObjectCrossReferenceEntry ¶
type ObjectCrossReferenceEntry struct { TileX int16 TileY int16 ObjectID ObjectID NextInTile int16 NextTileForObj int16 }
ObjectCrossReferenceEntry links objects and tiles.
func (*ObjectCrossReferenceEntry) Reset ¶
func (entry *ObjectCrossReferenceEntry) Reset()
Reset clears the members of the entry.
type ObjectCrossReferenceTable ¶
type ObjectCrossReferenceTable []ObjectCrossReferenceEntry
ObjectCrossReferenceTable is a list of entries. The first entry is reserved for internal use. For the reserved entry, The NextInTile member refers to the head of the single-linked free chain.
func DefaultObjectCrossReferenceTable ¶
func DefaultObjectCrossReferenceTable() ObjectCrossReferenceTable
DefaultObjectCrossReferenceTable returns an initialized table with a default size.
func (ObjectCrossReferenceTable) Allocate ¶ added in v0.4.0
func (table ObjectCrossReferenceTable) Allocate() int
Allocate attempts to reserve a free entry in the table and return its index. Returns 0 if exhausted.
func (ObjectCrossReferenceTable) Release ¶ added in v0.4.0
func (table ObjectCrossReferenceTable) Release(index int)
Release frees the entry with given index.
func (ObjectCrossReferenceTable) Reset ¶
func (table ObjectCrossReferenceTable) Reset()
Reset wipes the entire table and initializes all links.
type ObjectID ¶
type ObjectID int16
ObjectID identifies one object in a level. It is also the index into the master object table.
type ObjectMasterEntry ¶
type ObjectMasterEntry struct { InUse byte Class object.Class Subclass object.Subclass ClassTableIndex int16 CrossReferenceTableIndex int16 Next ObjectID Prev ObjectID X Coordinate Y Coordinate Z HeightUnit XRotation RotationUnit ZRotation RotationUnit YRotation RotationUnit Type object.Type Hitpoints int16 Extra [4]byte // contains filtered or unexported fields }
ObjectMasterEntry describes an object in the level.
func (*ObjectMasterEntry) Reset ¶
func (entry *ObjectMasterEntry) Reset()
Reset clears the entry and resets all members.
func (ObjectMasterEntry) Triple ¶ added in v0.4.0
func (entry ObjectMasterEntry) Triple() object.Triple
Triple returns the unique identifier of the entry.
type ObjectMasterTable ¶
type ObjectMasterTable []ObjectMasterEntry
ObjectMasterTable is a list of entries. The first entry is reserved for internal use. For the reserved entry, the Next field refers to the head of the single-linked free chain, and the CrossReferenceTableIndex refers to the head of the double-linked used chain.
func DefaultObjectMasterTable ¶
func DefaultObjectMasterTable() ObjectMasterTable
DefaultObjectMasterTable returns an initialized table with a default size.
func (ObjectMasterTable) Allocate ¶ added in v0.4.0
func (table ObjectMasterTable) Allocate() ObjectID
Allocate attempts to find an available entry in the table and activates it. Returns 0 if not possible (exhausted).
func (ObjectMasterTable) Release ¶ added in v0.4.0
func (table ObjectMasterTable) Release(id ObjectID)
Release deactivates the entry with given ID.
func (ObjectMasterTable) Reset ¶
func (table ObjectMasterTable) Reset()
Reset wipes the entire table and initializes all links.
type Parameters ¶
type Parameters struct { Size int16 CeilingHazardLevel byte FloorHazardLevel byte FloorHazardIsGravity byte BiohazardRegister byte RadiationRegister byte // contains filtered or unexported fields }
Parameters describes level-global properties. It also contains information on the auto-maps, which, as per original code, should have been in the game state.
func DefaultParameters ¶
func DefaultParameters() Parameters
DefaultParameters returns a new instance of parameters.
type RealWorldFlag ¶
type RealWorldFlag TileFlag
RealWorldFlag describes simple properties of a map tile in the real world.
func (RealWorldFlag) AsTileFlag ¶
func (flag RealWorldFlag) AsTileFlag() TileFlag
AsTileFlag returns the flags as regular tile flag value.
func (RealWorldFlag) CeilingShadow ¶
func (flag RealWorldFlag) CeilingShadow() int
CeilingShadow returns the ceiling shadow value. Range: [0..15].
func (RealWorldFlag) Deconstructed ¶
func (flag RealWorldFlag) Deconstructed() bool
Deconstructed returns whether the tile is marked as heavily deconstructed (should play spooky music).
func (RealWorldFlag) FloorShadow ¶
func (flag RealWorldFlag) FloorShadow() int
FloorShadow returns the floor shadow value. Range: [0..15].
func (RealWorldFlag) TileVisited ¶
func (flag RealWorldFlag) TileVisited() bool
TileVisited returns whether the tile is marked as being visited (seen).
func (RealWorldFlag) UseAdjacentWallTexture ¶
func (flag RealWorldFlag) UseAdjacentWallTexture() bool
UseAdjacentWallTexture returns whether the wall texture from the adjacent tile should be used for each side.
func (RealWorldFlag) WallTextureOffset ¶
func (flag RealWorldFlag) WallTextureOffset() TileHeightUnit
WallTextureOffset returns the vertical offset (in tile height units) to apply for wall textures.
func (RealWorldFlag) WallTexturePattern ¶
func (flag RealWorldFlag) WallTexturePattern() WallTexturePattern
WallTexturePattern returns the pattern to apply for walls.
func (RealWorldFlag) WithCeilingShadow ¶
func (flag RealWorldFlag) WithCeilingShadow(value int) RealWorldFlag
WithCeilingShadow returns a new flag value with the given ceiling shadow set. Values beyond allowed range are ignored.
func (RealWorldFlag) WithDeconstructed ¶
func (flag RealWorldFlag) WithDeconstructed(value bool) RealWorldFlag
WithDeconstructed returns a flag with the given deconstruction set.
func (RealWorldFlag) WithFloorShadow ¶
func (flag RealWorldFlag) WithFloorShadow(value int) RealWorldFlag
WithFloorShadow returns a new flag value with the given floor shadow set. Values beyond allowed range are ignored.
func (RealWorldFlag) WithTileVisited ¶
func (flag RealWorldFlag) WithTileVisited(value bool) RealWorldFlag
WithTileVisited returns a flag with the given deconstruction set.
func (RealWorldFlag) WithUseAdjacentWallTexture ¶
func (flag RealWorldFlag) WithUseAdjacentWallTexture(value bool) RealWorldFlag
WithUseAdjacentWallTexture returns a flag with the given usage set.
func (RealWorldFlag) WithWallTextureOffset ¶
func (flag RealWorldFlag) WithWallTextureOffset(value TileHeightUnit) RealWorldFlag
WithWallTextureOffset returns a flag value with the given wall texture offset.
func (RealWorldFlag) WithWallTexturePattern ¶
func (flag RealWorldFlag) WithWallTexturePattern(value WallTexturePattern) RealWorldFlag
WithWallTexturePattern returns a flag with the given pattern set.
type RotationUnit ¶
type RotationUnit byte
RotationUnit describes a rotation in the range 0..255.
func (RotationUnit) ToDegrees ¶ added in v0.4.0
func (unit RotationUnit) ToDegrees() float64
ToDegrees returns the value converted to degrees [0..360).
type SchedulerInfo ¶
type SchedulerInfo struct { // Size describes the maximum amount of schedule entries in the table. Size int32 // ScheduleCount is the current amount of active schedules. ScheduleCount int32 // ElementSize is the size of an schedule entry, in bytes. ElementSize int32 // GrowFlag indicates whether the schedule table can be resized. GrowFlag byte // contains filtered or unexported fields }
SchedulerInfo describes the basic parameters of a level scheduler. Its entries are stored in the Schedules table.
func DefaultSchedulerInfo ¶
func DefaultSchedulerInfo() SchedulerInfo
DefaultSchedulerInfo returns a new scheduler info structure with default values.
type SlopeFactors ¶
type SlopeFactors [8]float32
SlopeFactors is a list of multipliers for each direction of a tile.
func (SlopeFactors) Negated ¶
func (factors SlopeFactors) Negated() SlopeFactors
Negated returns the factors multiplied by -1.
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.
func TextureAnimationLoopTypes ¶
func TextureAnimationLoopTypes() []TextureAnimationLoopType
TextureAnimationLoopTypes returns all constants.
func (TextureAnimationLoopType) String ¶
func (loopType TextureAnimationLoopType) String() string
String returns the textual representation.
type TextureAtlas ¶
type TextureAtlas []TextureIndex
TextureAtlas is a selection of textures for the level.
type TileFlag ¶
type TileFlag uint32
TileFlag describes simple properties of a map tile.
func (TileFlag) ForCyberspace ¶
func (flag TileFlag) ForCyberspace() CyberspaceFlag
ForCyberspace interprets the flag value for cyberspace.
func (TileFlag) ForRealWorld ¶
func (flag TileFlag) ForRealWorld() RealWorldFlag
ForRealWorld interprets the flag value for the real world.
func (TileFlag) MusicIndex ¶
MusicIndex returns the music identifier. Range: [0..15].
func (TileFlag) SlopeControl ¶
func (flag TileFlag) SlopeControl() TileSlopeControl
SlopeControl returns the slope control as per flags.
func (TileFlag) WithMusicIndex ¶
WithMusicIndex returns a new flag value with the given music index set. Values beyond allowed range are ignored.
func (TileFlag) WithSlopeControl ¶
func (flag TileFlag) WithSlopeControl(ctrl TileSlopeControl) TileFlag
WithSlopeControl returns a new flag value with the given slope control set.
type TileHeightUnit ¶
type TileHeightUnit byte
TileHeightUnit describes a height in a range of 0..32.
const ( TileHeightUnitMin TileHeightUnit = 0 TileHeightUnitMax TileHeightUnit = 32 )
TileHeightUnit constants
type TileMap ¶
type TileMap [][]TileMapEntry
TileMap is a rectangular set of tiles. The first index is the Y-axis, the second index the X-axis. This way the map can be serialized quicker.
func NewTileMap ¶
NewTileMap returns a new, initialized map.
func (TileMap) Tile ¶
func (m TileMap) Tile(x, y int) *TileMapEntry
Tile returns a pointer to the tile within the map for given position. Nil is returned for a coordinate outside the boundaries.
type TileMapEntry ¶
type TileMapEntry struct { // Type indicates what kind of tile this is. Type TileType // Floor describes floor properties. Floor FloorInfo // Ceiling describes ceiling properties. Ceiling CeilingInfo // SlopeHeight indicates for non-flat tiles the height offset. SlopeHeight TileHeightUnit // FirstObjectIndex points into the level object cross reference table to the first object in this tile. FirstObjectIndex int16 // TextureInfo describes tile texturing. TextureInfo TileTextureInfo // Flags contains arbitrary additional information. Flags TileFlag // SubClip is always 0xFF. SubClip byte // LightDelta describes the light offsets of this tile. LightDelta byte // contains filtered or unexported fields }
TileMapEntry describes one tile of the map.
func (*TileMapEntry) Reset ¶
func (tile *TileMapEntry) Reset()
Reset puts the tile into an initial state.
type TileSlopeControl ¶
type TileSlopeControl byte
TileSlopeControl defines how the floor and ceiling of a sloped tile should be processed.
const ( TileSlopeControlCeilingInverted TileSlopeControl = 0 TileSlopeControlCeilingMirrored TileSlopeControl = 1 TileSlopeControlCeilingFlat TileSlopeControl = 2 TileSlopeControlFloorFlat TileSlopeControl = 3 )
TileSlopeControl constants.
func TileSlopeControls ¶
func TileSlopeControls() []TileSlopeControl
TileSlopeControls returns all control values.
func (TileSlopeControl) CeilingSlopeFactors ¶
func (ctrl TileSlopeControl) CeilingSlopeFactors(tileType TileType) SlopeFactors
CeilingSlopeFactors returns the slope factors for the given tile type as per control constant.
func (TileSlopeControl) FloorSlopeFactors ¶
func (ctrl TileSlopeControl) FloorSlopeFactors(tileType TileType) SlopeFactors
FloorSlopeFactors returns the slope factors for the given tile type as per control constant.
func (TileSlopeControl) String ¶
func (ctrl TileSlopeControl) String() string
String returns the textual representation of the value.
type TileTextureInfo ¶
type TileTextureInfo uint16
TileTextureInfo describes the textures used for a map tile.
func (TileTextureInfo) CeilingPaletteIndex ¶
func (info TileTextureInfo) CeilingPaletteIndex() byte
CeilingPaletteIndex returns the palette index for the ceiling in cyberspace.
func (TileTextureInfo) CeilingTextureIndex ¶
func (info TileTextureInfo) CeilingTextureIndex() int
CeilingTextureIndex returns the texture index into the texture atlas for the ceiling. Valid range [0..31]. This property is only valid in real world.
func (TileTextureInfo) FloorPaletteIndex ¶
func (info TileTextureInfo) FloorPaletteIndex() byte
FloorPaletteIndex returns the palette index for the floor in cyberspace.
func (TileTextureInfo) FloorTextureIndex ¶
func (info TileTextureInfo) FloorTextureIndex() int
FloorTextureIndex returns the texture index into the texture atlas for the floor. Valid range [0..31]. This property is only valid in real world.
func (TileTextureInfo) WallTextureIndex ¶
func (info TileTextureInfo) WallTextureIndex() int
WallTextureIndex returns the texture index into the texture atlas for the walls. Valid range [0..63]. This property is only valid in real world.
func (TileTextureInfo) WithCeilingPaletteIndex ¶
func (info TileTextureInfo) WithCeilingPaletteIndex(value byte) TileTextureInfo
WithCeilingPaletteIndex returns an info with given index set.
func (TileTextureInfo) WithCeilingTextureIndex ¶
func (info TileTextureInfo) WithCeilingTextureIndex(value int) TileTextureInfo
WithCeilingTextureIndex returns an info with given index set. Values outside valid range are ignored.
func (TileTextureInfo) WithFloorPaletteIndex ¶
func (info TileTextureInfo) WithFloorPaletteIndex(value byte) TileTextureInfo
WithFloorPaletteIndex returns an info with given index set.
func (TileTextureInfo) WithFloorTextureIndex ¶
func (info TileTextureInfo) WithFloorTextureIndex(value int) TileTextureInfo
WithFloorTextureIndex returns an info with given index set. Values outside valid range are ignored.
func (TileTextureInfo) WithWallTextureIndex ¶
func (info TileTextureInfo) WithWallTextureIndex(value int) TileTextureInfo
WithWallTextureIndex returns an info with given index set. Values outside valid range are ignored.
type TileType ¶
type TileType byte
TileType describes the general type of a map tile.
const ( TileTypeSolid TileType = 0x00 TileTypeOpen TileType = 0x01 TileTypeDiagonalOpenSouthEast TileType = 0x02 TileTypeDiagonalOpenSouthWest TileType = 0x03 TileTypeDiagonalOpenNorthWest TileType = 0x04 TileTypeDiagonalOpenNorthEast TileType = 0x05 TileTypeSlopeSouthToNorth TileType = 0x06 TileTypeSlopeWestToEast TileType = 0x07 TileTypeSlopeNorthToSouth TileType = 0x08 TileTypeSlopeEastToWest TileType = 0x09 TileTypeValleySouthEastToNorthWest TileType = 0x0A TileTypeValleySouthWestToNorthEast TileType = 0x0B TileTypeValleyNorthWestToSouthEast TileType = 0x0C TileTypeValleyNorthEastToSouthWest TileType = 0x0D TileTypeRidgeNorthWestToSouthEast TileType = 0x0E TileTypeRidgeNorthEastToSouthWest TileType = 0x0F TileTypeRidgeSouthEastToNorthWest TileType = 0x10 TileTypeRidgeSouthWestToNorthEast 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.
func (TileType) Info ¶
func (t TileType) Info() TileTypeInfo
Info returns the information associated with the tile type.
type TileTypeInfo ¶
type TileTypeInfo struct { // Name is the textual representation of the tile type. Name string // SolidSides is a bitfield of cardinal directions describing solid walls. SolidSides DirectionMask // SlopeFloorFactors defines how a slope affects the floor in each direction of a tile [0.0 .. 1.0]. SlopeFloorFactors SlopeFactors // SlopeInvertedType is the type that inverts the slope to form a solid tile if merged (e.g. floor & ceiling). // Types that have no slope invert themselves. SlopeInvertedType TileType }
TileTypeInfo is the meta information about a tile type.
type WallHeights ¶
WallHeights describes the height delta, in HeightUnits, one would take to cross to the other tile. A value of 0 means equal floor, a negative value a fall down. A value of 0x20 (= maximum of height units) means a solid wall.
For each cardinal direction, facing to the specified direction, the first entry is the left side, the second the center, and the third the right side.
type WallHeightsMap ¶
type WallHeightsMap [][]WallHeights
WallHeightsMap is rectangular table of wall heights, typically mirroring a tile map.
func NewWallHeightsMap ¶
func NewWallHeightsMap(width, height int) WallHeightsMap
NewWallHeightsMap returns a new, initialized map.
func (*WallHeightsMap) CalculateFrom ¶
func (m *WallHeightsMap) CalculateFrom(tileMap TileMap)
CalculateFrom updates all the wall heights according to the specified map.
func (WallHeightsMap) Tile ¶
func (m WallHeightsMap) Tile(x, y int) *WallHeights
Tile returns a pointer to the tile within the map for given position.
type WallTexturePattern ¶
type WallTexturePattern byte
WallTexturePattern describes how a wall texture should be applied for a tile.
const ( WallTexturePatternRegular WallTexturePattern = 0 WallTexturePatternFlipHorizontal WallTexturePattern = 1 WallTexturePatternFlipAlternating WallTexturePattern = 2 WallTexturePatternFlipAlternatingInverted WallTexturePattern = 3 )
WallTexturePattern constants
func WallTexturePatterns ¶
func WallTexturePatterns() []WallTexturePattern
WallTexturePatterns returns all available texture patterns.
func (WallTexturePattern) String ¶
func (pattern WallTexturePattern) String() string
String returns the textual information.
Source Files ¶
- BaseInfo.go
- BlockPuzzleState.go
- Constants.go
- Coordinate.go
- CyberspaceFlightPull.go
- Direction.go
- EmptyLevelData.go
- FloorCeilingInfo.go
- HeightSemaphores.go
- HeightShift.go
- HeightUnit.go
- Level.go
- LoopConfigEntry.go
- MapNotes.go
- ObjectClassInfo.go
- ObjectClassTable.go
- ObjectCrossReferenceTable.go
- ObjectID.go
- ObjectMasterTable.go
- Parameters.go
- RotationUnit.go
- SchedulerInfo.go
- Surveillance.go
- TextureAnimationEntry.go
- TextureIndex.go
- TileFlag.go
- TileHeightUnit.go
- TileMap.go
- TileSlopeControl.go
- TileTextureInfo.go
- TileType.go
- TileTypeInfo.go
- Unknowns.go
- WallHeights.go
- WallTexturePattern.go