model

package module
v0.0.0-...-02e3864 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: 3 Imported by: 14

README

InkyBlackness Shocked-Model

Obsolescence Notice: Due to the release of InkyBlackness - HackEd, this project here has become obsolete: HackEd is the new editor to be used and is fully self-contained. Furthermore, this project is based on pre-source-release information. Use it at your own risk.

This is a library as part of the InkyBlackness project, written in Go. This library contains the API model of Shocked. It consists entirely of data objects.

License

The project is available under the terms of the New BSD License (see LICENSE file).

Documentation

Index

Constants

View Source
const (
	// ElectronicMessageTypeMail is for wireless mails.
	ElectronicMessageTypeMail ElectronicMessageType = "mail"
	// ElectronicMessageTypeLog is for collected logs.
	ElectronicMessageTypeLog = "log"
	// ElectronicMessageTypeFragment is for downloaded fragments.
	ElectronicMessageTypeFragment = "fragment"
)
View Source
const (
	MaxTrapMessages     = 512
	MaxWords            = 512
	MaxLogCategories    = 16
	MaxVariousMessages  = 256
	MaxScreenMessages   = 120
	MaxInfoNodeMessages = 256
	MaxAccessCardNames  = 32 * 2
	MaxDataletMessages  = 256
	MaxPaperTexts       = 16
	MaxPanelNames       = 256
)

Maximum values for text resource types

View Source
const (
	// ResourceLanguageUnspecific is for non-specific resources.
	ResourceLanguageUnspecific = ResourceLanguage(0)
	// ResourceLanguageStandard is for the default language (English).
	ResourceLanguageStandard = ResourceLanguage(1)
	// ResourceLanguageFrench is for French.
	ResourceLanguageFrench = ResourceLanguage(2)
	// ResourceLanguageGerman is for German.
	ResourceLanguageGerman = ResourceLanguage(3)
)
View Source
const (
	// ResourceTypeMfdDataImages refers to the bitmaps used in the MFD data displays, such as logs.
	ResourceTypeMfdDataImages = ResourceType(0x0028)

	// ResourceTypeTrapMessages refers to the texts shown in the MFD based on actions.
	ResourceTypeTrapMessages = ResourceType(0x0867)
	// ResourceTypeWords refers to the texts of WORDS level objects.
	ResourceTypeWords = ResourceType(0x0868)
	// ResourceTypeLogCategories contains the category names of logs.
	ResourceTypeLogCategories = ResourceType(0x0870)
	// ResourceTypeVariousMessages contains all sorts of messages, including door lock messages.
	ResourceTypeVariousMessages = ResourceType(0x0871)
	// ResourceTypeScreenMessages contains the messages shown on screens.
	ResourceTypeScreenMessages = ResourceType(0x0877)
	// ResourceTypeInfoNodeMessages contains the short text fragments found in cyberspace of 8/5/6 nodes.
	ResourceTypeInfoNodeMessages = ResourceType(0x0878)
	// ResourceTypeAccessCardNames contains the names of the access cards.
	ResourceTypeAccessCardNames = ResourceType(0x0879)
	// ResourceTypeDataletMessages contains the short text fragments found in cyberspace of 8/5/8 nodes.
	ResourceTypeDataletMessages = ResourceType(0x087A)

	// ResourceTypePaperTexts refers to the texts written on lose papers.
	ResourceTypePaperTexts = ResourceType(0x003C)

	// ResourceTypePanelNames are specialized panel descriptions.
	ResourceTypePanelNames = ResourceType(0x0869)

	// ResourceTypeTrapAudio refers to the audio played along trap messages.
	ResourceTypeTrapAudio = ResourceType(0x0C1C)
)
View Source
const (
	SlopeCeilingInverted = "ceilingInverted"
	SlopeCeilingMirrored = "ceilingMirrored"
	SlopeCeilingFlat     = "ceilingFlat"
	SlopeFloorFlat       = "floorFlat"
)

All known slope control values, as string.

View Source
const (
	TextureIcon   TextureSize = "icon"
	TextureSmall              = "small"
	TextureMedium             = "medium"
	TextureLarge              = "large"
)
View Source
const (
	Solid TileType = "solid"
	Open           = "open"

	DiagonalOpenSouthEast = "diagonalOpenSouthEast"
	DiagonalOpenSouthWest = "diagonalOpenSouthWest"
	DiagonalOpenNorthWest = "diagonalOpenNorthWest"
	DiagonalOpenNorthEast = "diagonalOpenNorthEast"

	SlopeSouthToNorth = "slopeSouthToNorth"
	SlopeWestToEast   = "slopeWestToEast"
	SlopeNorthToSouth = "slopeNorthToSouth"
	SlopeEastToWest   = "slopeEastToWest"

	ValleySouthEastToNorthWest = "valleySouthEastToNorthWest"
	ValleySouthWestToNorthEast = "valleySouthWestToNorthEast"
	ValleyNorthWestToSouthEast = "valleyNorthWestToSouthEast"
	ValleyNorthEastToSouthWest = "valleyNorthEastToSouthWest"

	RidgeNorthWestToSouthEast = "ridgeNorthWestToSouthEast"
	RidgeNorthEastToSouthWest = "ridgeNorthEastToSouthWest"
	RidgeSouthEastToNorthWest = "ridgeSouthEastToNorthWest"
	RidgeSouthWestToNorthEast = "ridgeSouthWestToNorthEast"
)

All known tile types, as string

View Source
const (
	// LanguageCount specifies the amount of known languages.
	// The mapping is 0 := ENG, 1 := FRN, 2 := GER for the resource files.
	LanguageCount = 3
)

Variables

This section is empty.

Functions

func MaxEntriesFor

func MaxEntriesFor(resourceType ResourceType) int

MaxEntriesFor returns the maximum count of resources of a given type.

Types

type CalculatedWallHeights

type CalculatedWallHeights struct {
	// North side of the tile (up)
	North float32
	// East side of the tile (right)
	East float32
	// West side of the tile (left)
	West float32
	// South side of the tile (down)
	South float32
}

CalculatedWallHeights describes for each direction of a tile how walled off the given side is of a tile.

type Color

type Color struct {
	Red   int
	Green int
	Blue  int
}

Color describes a single color value. The channels have a range of 0..255 .

func (Color) RGBA

func (clr Color) RGBA() (r, g, b, a uint32)

RGBA implements the image/color interface.

type CyberspaceTileProperties

type CyberspaceTileProperties struct {
	FloorColorIndex   *int
	CeilingColorIndex *int

	FlightPullType *int

	GameOfLifeSet *bool
}

CyberspaceTileProperties describes tile properties of cyberspace.

type DataStore

type DataStore interface {
	// Projects queries the currently available projects.
	Projects(onSuccess func(projects []string), onFailure FailureFunc)
	// NewProject requests to create a new project with given ID.
	NewProject(projectID string, onSuccess func(), onFailure FailureFunc)

	// SaveProject requests to persist all pending modifications.
	SaveProject(projectID string)

	// Font queries a specific font.
	Font(projectID string, fontID int, onSuccess func(font *Font), onFailure FailureFunc)

	// Bitmap queries the data of a bitmap resource.
	Bitmap(projectID string, key ResourceKey,
		onSuccess func(ResourceKey, *RawBitmap), onFailure FailureFunc)
	// SetBitmap requests to set the data of a bitmap resource.
	SetBitmap(projectID string, key ResourceKey, bmp *RawBitmap,
		onSuccess func(ResourceKey, *RawBitmap), onFailure FailureFunc)

	// Text queries the data of a text resource.
	Text(projectID string, key ResourceKey,
		onSuccess func(ResourceKey, string), onFailure FailureFunc)
	// SetText requests to set the data of a text resource.
	SetText(projectID string, key ResourceKey, text string,
		onSuccess func(ResourceKey, string), onFailure FailureFunc)

	// Audio queries the data of an audio resource.
	Audio(projectID string, key ResourceKey,
		onSuccess func(ResourceKey, audio.SoundData), onFailure FailureFunc)
	// SetAudio requests to set the audio of a text resource.
	SetAudio(projectID string, key ResourceKey, data audio.SoundData,
		onSuccess func(ResourceKey), onFailure FailureFunc)

	// GameObjects queries the basic properties of all objects in the project.
	GameObjects(projectID string, onSuccess func(objects []GameObject), onFailure FailureFunc)
	// GameObjectIcon queries the icon bitmap of a game object.
	GameObjectIcon(projectID string, class, subclass, objType int, onSuccess func(bmp *RawBitmap), onFailure FailureFunc)
	// SetGameObject requests to update the properties of a game object.
	SetGameObject(projectID string, class, subclass, objType int, properties *GameObjectProperties,
		onSuccess func(properties *GameObjectProperties), onFailure FailureFunc)
	// GameObjectBitmap queries the data of a bitmap resource for a game object.
	GameObjectBitmap(projectID string, class, subclass, objType int, index int,
		onSuccess func(*RawBitmap), onFailure FailureFunc)
	// SetGameObjectBitmap requests to set the data of a bitmap resource for a game object.
	SetGameObjectBitmap(projectID string, class, subclass, objType int, index int, bmp *RawBitmap,
		onSuccess func(), onFailure FailureFunc)

	// ElectronicMessage queries the data of a specific electronic message.
	ElectronicMessage(projectID string, messageType ElectronicMessageType, id int,
		onSuccess func(message ElectronicMessage), onFailure FailureFunc)
	// SetElectronicMessage requests to update the properties of a specific electronic message.
	SetElectronicMessage(projectID string, messageType ElectronicMessageType, id int, message ElectronicMessage,
		onSuccess func(message ElectronicMessage), onFailure FailureFunc)
	// ElectronicMessageAudio queries the audio part of a specific electronic message.
	ElectronicMessageAudio(projectID string, messageType ElectronicMessageType, id int, language ResourceLanguage,
		onSuccess func(data audio.SoundData), onFailure FailureFunc)
	// SetElectronicMessageAudio requests to update the audio part of a specific electronic message.
	SetElectronicMessageAudio(projectID string, messageType ElectronicMessageType, id int, language ResourceLanguage, data audio.SoundData,
		onSuccess func(), onFailure FailureFunc)
	// RemoveElectronicMessage requests to remove the identified message from the resources.
	RemoveElectronicMessage(projectID string, messageType ElectronicMessageType, id int,
		onSuccess func(), onFailure FailureFunc)

	// Palette queries a palette.
	Palette(projectID string, paletteID string, onSuccess func(colors [256]Color), onFailure FailureFunc)
	// Levels queries all levels of a project.
	Levels(projectID string, archiveID string, onSuccess func(levels []Level), onFailure FailureFunc)

	// LevelProperties requests the basic properties of a level.
	LevelProperties(projectID string, archiveID string, levelID int, onSuccess func(properties LevelProperties), onFailure FailureFunc)
	// SetLevelProperties requests to update basic properties of a level.
	SetLevelProperties(projectID string, archiveID string, levelID int, properties LevelProperties,
		onSuccess func(properties LevelProperties), onFailure FailureFunc)

	// LevelTextures queries the texture IDs for a level.
	LevelTextures(projectID string, archiveID string, levelID int, onSuccess func(textureIDs []int), onFailure FailureFunc)
	// SetLevelTextures requests to set the list of textures for a level.
	SetLevelTextures(projectID string, archiveID string, levelID int, textureIDs []int, onSuccess func(textureIDs []int), onFailure FailureFunc)
	// LevelTextureAnimations queries the animation properties of texture groups.
	LevelTextureAnimations(projectID string, archiveID string, levelID int,
		onSuccess func(animations []TextureAnimation), onFailure FailureFunc)
	// SetLevelTextureAnimation requests to change the properties of an animated texture group.
	SetLevelTextureAnimation(projectID string, archiveID string, levelID int, animationGroup int, properties TextureAnimation,
		onSuccess func(animations []TextureAnimation), onFailure FailureFunc)

	// Textures queries all texture information of a project.
	Textures(projectID string, onSuccess func(textures []TextureProperties), onFailure FailureFunc)
	// SetTextureProperties requests to change properties of a single texture.
	SetTextureProperties(projectID string, textureID int, newProperties *TextureProperties,
		onSuccess func(properties *TextureProperties), onFailure FailureFunc)
	// TextureBitmap queries the texture bitmap of a texture.
	TextureBitmap(projectID string, textureID int, size string, onSuccess func(bmp *RawBitmap), onFailure FailureFunc)
	// SetTextureBitmap requests to update the bitmap of a texture.
	SetTextureBitmap(projectID string, textureID int, size string, bmp *RawBitmap,
		onSuccess func(bmp *RawBitmap), onFailure FailureFunc)

	// Tiles queries the complete tile map of a level.
	Tiles(projectID string, archiveID string, levelID int, onSuccess func(tiles Tiles), onFailure FailureFunc)

	// Tile requests the properties of a specific tile.
	Tile(projectID string, archiveID string, levelID int, x, y int,
		onSuccess func(properties TileProperties), onFailure FailureFunc)
	// SetTile requests to update properties of a specific tile.
	SetTile(projectID string, archiveID string, levelID int, x, y int, properties TileProperties,
		onSuccess func(properties TileProperties), onFailure FailureFunc)

	// LevelObjects requests all objects of the level.
	LevelObjects(projectID string, archiveID string, levelID int,
		onSuccess func(objects *LevelObjects), onFailure FailureFunc)
	// AddLevelObject requests to add a new object to the level.
	AddLevelObject(projectID string, archiveID string, levelID int, template LevelObjectTemplate,
		onSuccess func(object LevelObject), onFailure FailureFunc)
	// RemoveLevelObject requests to remove an object from the level.
	RemoveLevelObject(projectID string, archiveID string, levelID int, objectID int,
		onSuccess func(), onFailure FailureFunc)
	// SetLevelObject requests to update object properties.
	SetLevelObject(projectID string, archiveID string, levelID int, objectID int, properties *LevelObjectProperties,
		onSuccess func(properties *LevelObjectProperties), onFailure FailureFunc)

	// LevelSurveillanceObjects requests all surveillance objects of the identified level.
	LevelSurveillanceObjects(projectID string, archiveID string, levelID int,
		onSuccess func(objects []SurveillanceObject), onFailure FailureFunc)
	// SetLevelSurveillanceObject requests to set the properties of one surveillance object.
	SetLevelSurveillanceObject(projectID string, archiveID string, levelID int, surveillanceIndex int, data SurveillanceObject,
		onSuccess func(objects []SurveillanceObject), onFailure FailureFunc)
}

DataStore describes the necessary methods for querying and modifying model data.

type ElectronicMessage

type ElectronicMessage struct {
	// NextMessage describes the message that will interrupt this one. -1 for no interrupt.
	NextMessage *int
	// IsInterrupt is set for interrupting messages.
	IsInterrupt *bool
	// ColorIndex for special colored headers. -1 for default.
	ColorIndex *int
	// LeftDisplay identifies the image for the left display. -1 for none.
	LeftDisplay *int
	// RightDisplay identifies the image for the right display. -1 for none.
	RightDisplay *int

	Title       [LanguageCount]*string
	Sender      [LanguageCount]*string
	Subject     [LanguageCount]*string
	VerboseText [LanguageCount]*string
	TerseText   [LanguageCount]*string
}

ElectronicMessage describes the base properties of an electronic message.

type ElectronicMessageType

type ElectronicMessageType string

ElectronicMessageType classifies the messages.

func ElectronicMessageTypes

func ElectronicMessageTypes() []ElectronicMessageType

ElectronicMessageTypes returns all known message types.

type FailureFunc

type FailureFunc func()

FailureFunc is for failed queries.

type Font

type Font struct {
	// Monochrome fonts have black/white bitmaps. They receive color later.
	Monochrome bool
	// Bitmap contains the raw bitmap of the font. Monochrome fonts have their pixel values set to 1 for visible pixels.
	Bitmap RawBitmap

	// FirstCharacter is the index of the first represented character of this font.
	FirstCharacter int
	// GlyphXOffsets is the horizontal offset for the character with given index. The width of a
	// character is the different to the next characters offset.
	GlyphXOffsets []int
}

Font describes an ingame bitmap font.

type GameObject

type GameObject struct {
	Class    int
	Subclass int
	Type     int

	Properties GameObjectProperties
}

GameObject describes one general game object

type GameObjectProperties

type GameObjectProperties struct {
	// ShortName is the (language specific) short name of the object.
	ShortName [LanguageCount]*string
	// LongName is the (language specific) long name of the object.
	LongName [LanguageCount]*string

	Data objprop.ObjectData
}

GameObjectProperties globally describe a game object.

type HeightUnit

type HeightUnit int

HeightUnit has a size which is dependent on the scaling factor of a level.

type Level

type Level struct {
	ID int
}

Level describes one level of the archive.

type LevelObject

type LevelObject struct {
	ID int

	Class      int
	Properties LevelObjectProperties
}

LevelObject describes one object of the level.

type LevelObjectProperties

type LevelObjectProperties struct {
	Subclass *int
	Type     *int

	TileX *int
	FineX *int
	TileY *int
	FineY *int
	Z     *int

	ClassData []byte

	RotationX *int
	RotationY *int
	RotationZ *int
	Hitpoints *int

	ExtraData []byte
}

LevelObjectProperties describe the mutable properties of a level object

type LevelObjectTemplate

type LevelObjectTemplate struct {
	Class    int
	Subclass int
	Type     int

	TileX int
	FineX int
	TileY int
	FineY int
	Z     int

	Hitpoints int
}

LevelObjectTemplate contains the minimum information for a new level object.

type LevelObjects

type LevelObjects struct {
	Table []LevelObject
}

LevelObjects contains a table of all level objects

type LevelProperties

type LevelProperties struct {
	HeightShift    *int
	CyberspaceFlag *bool

	CeilingHasRadiation *bool
	CeilingEffectLevel  *int

	FloorHasBiohazard *bool
	FloorHasGravity   *bool
	FloorEffectLevel  *int
}

LevelProperties contains basic level information.

type Palette

type Palette struct {
	// Colors contains the color values of the palette.
	Colors [256]Color
}

Palette is an identifiable list of colors.

type RawBitmap

type RawBitmap struct {
	// Width of the image in pixel
	Width int
	// Height of the image in pixel
	Height int
	// Pixel data is provided as base64 encoded byte string, with the stride equal the width.
	Pixels string
}

RawBitmap is a simple palette based image.

type RealWorldTileProperties

type RealWorldTileProperties struct {
	FloorTexture   *int
	CeilingTexture *int
	WallTexture    *int

	FloorTextureRotations   *int
	CeilingTextureRotations *int

	UseAdjacentWallTexture *bool
	WallTextureOffset      *HeightUnit
	WallTexturePattern     *int

	FloorHazard   *bool
	CeilingHazard *bool

	FloorShadow   *int
	CeilingShadow *int

	SpookyMusic *bool
}

RealWorldTileProperties describes tile properties of the real wold.

type ResourceKey

type ResourceKey struct {
	Type     ResourceType
	Language ResourceLanguage
	Index    uint16
}

ResourceKey is the reference of a specific game resource.

func MakeLocalizedResourceKey

func MakeLocalizedResourceKey(resourceType ResourceType, language ResourceLanguage, index uint16) ResourceKey

MakeLocalizedResourceKey returns a combined resource identifier with specified language.

func MakeResourceKey

func MakeResourceKey(resourceType ResourceType, index uint16) ResourceKey

MakeResourceKey returns a combined resource identifier.

func ResourceKeyFromInt

func ResourceKeyFromInt(value int) ResourceKey

ResourceKeyFromInt returns a resource identifier wrapping the provided integer.

func (ResourceKey) HasValidLanguage

func (id ResourceKey) HasValidLanguage() bool

HasValidLanguage returns true if the Language field is within range [1..3].

func (ResourceKey) String

func (id ResourceKey) String() string

String implements the Stringer interface.

func (ResourceKey) ToInt

func (id ResourceKey) ToInt() int

ToInt returns a single integer representation of the ID.

type ResourceLanguage

type ResourceLanguage uint8

ResourceLanguage specifies the language of a localized resource

func LocalLanguages

func LocalLanguages() []ResourceLanguage

LocalLanguages returns a slice of all local languages

func (ResourceLanguage) ShortName

func (lang ResourceLanguage) ShortName() string

ShortName is a three-letter identification of the language.

func (ResourceLanguage) ToIndex

func (lang ResourceLanguage) ToIndex() int

ToIndex returns an integer for localized arrays.

type ResourceType

type ResourceType uint16

ResourceType is an enumeration of resource clusters.

type SlopeControl

type SlopeControl string

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

func SlopeControls

func SlopeControls() []SlopeControl

SlopeControls returns all available slope control values.

type SurveillanceObject

type SurveillanceObject struct {
	SourceIndex     *int
	DeathwatchIndex *int
}

SurveillanceObject describes one object for surveillance sources.

type TextureAnimation

type TextureAnimation struct {
	FrameTime  *int
	FrameCount *int
	LoopType   *int
}

TextureAnimation describes the level specific animation properties for a texture group.

type TextureProperties

type TextureProperties struct {
	// Name is the (language specific) name of the texture.
	Name [LanguageCount]*string
	// CantBeUsed is a (language specific) text for usage failures.
	CantBeUsed [LanguageCount]*string

	// Climbable determines whether the texture can be climbed, such as ladders.
	Climbable *bool
	// TransparencyControl determines how to interpret bitmap data.
	TransparencyControl *int
	// AnimationGroup relates textures for an animation.
	AnimationGroup *int
	// AnimationIndex identifies a texture within a group.
	AnimationIndex *int
}

TextureProperties contain all the behavioural settings of a texture.

type TextureSize

type TextureSize string

TextureSize is an enumeration of allowed texture sizes.

func TextureSizes

func TextureSizes() []TextureSize

TextureSizes returns an array of all supported texture sizes

type TileProperties

type TileProperties struct {
	Type *TileType

	FloorHeight   *HeightUnit
	CeilingHeight *HeightUnit
	SlopeHeight   *HeightUnit

	SlopeControl *SlopeControl

	CalculatedWallHeights *CalculatedWallHeights

	MusicIndex *int

	RealWorld  *RealWorldTileProperties
	Cyberspace *CyberspaceTileProperties
}

TileProperties describe one tile in the map.

type TileType

type TileType string

TileType describes the basic type of a tile.

func TileTypes

func TileTypes() []TileType

TileTypes returns a list of all types.

type Tiles

type Tiles struct {
	Table [][]TileProperties
}

Tiles contains all tile properties of a map.

Jump to

Keyboard shortcuts

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