object

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package object contains the game-global properties of objects.

Index

Constants

View Source
const (
	// ClassCount describes how many object classes there are.
	ClassCount = 15
)
View Source
const (
	// CommonPropertiesSize specifies, in bytes, the length a common properties structure has.
	CommonPropertiesSize = 27
)

Variables

This section is empty.

Functions

func Pivot added in v1.1.0

func Pivot(prop CommonProperties) float32

Pivot returns the assumed height offset for placing objects.

Types

type Class

type Class byte

Class describes a general category of objects.

const (
	ClassGun        Class = 0
	ClassAmmo       Class = 1
	ClassPhysics    Class = 2
	ClassGrenade    Class = 3
	ClassDrug       Class = 4
	ClassHardware   Class = 5
	ClassSoftware   Class = 6
	ClassBigStuff   Class = 7
	ClassSmallStuff Class = 8
	ClassFixture    Class = 9
	ClassDoor       Class = 10
	ClassAnimating  Class = 11
	ClassTrap       Class = 12
	ClassContainer  Class = 13
	ClassCritter    Class = 14
)

Object classes constants.

func Classes added in v0.4.0

func Classes() []Class

Classes returns a list of all classes.

func (Class) String added in v0.4.0

func (c Class) String() string

String returns the textual representation.

type ClassDescriptor added in v0.4.0

type ClassDescriptor struct {
	// GenericDataSize specifies the length, in bytes, of one generic type entry.
	GenericDataSize int
	// Subclasses contains descriptions of the subclasses of this class.
	// The index into the array is the subclass ID.
	Subclasses []SubclassDescriptor
}

ClassDescriptor describes a single object class.

func (ClassDescriptor) TotalDataSize added in v0.4.0

func (desc ClassDescriptor) TotalDataSize() int

TotalDataSize returns the total length the class requires.

func (ClassDescriptor) TotalTypeCount added in v0.4.0

func (desc ClassDescriptor) TotalTypeCount() int

TotalTypeCount returns the total number of types in this class.

type ClassProperties added in v0.4.0

type ClassProperties []SubclassProperties

ClassProperties is a collection of subclass-specific properties.

type CommonProperties added in v0.4.0

type CommonProperties struct {
	Mass          int32
	Hitpoints     int16
	Armor         byte
	RenderType    RenderType
	PhysicsModel  byte
	Hardness      byte
	Pep           byte
	PhysicsXR     byte
	PhysicsY      byte
	PhysicsZ      byte
	Resistances   uint32
	DefenseValue  byte
	Toughness     byte
	Flags         uint16
	MfdId         uint16
	Bitmap3D      uint16
	DestroyEffect byte
}

CommonProperties are generic ones available for all objects.

type Descriptors added in v0.4.0

type Descriptors []ClassDescriptor

Descriptors describes a set of object classes.

func StandardDescriptors added in v0.4.0

func StandardDescriptors() Descriptors

StandardDescriptors returns an array of class descriptors that represent the standard configuration of the existing objprop.dat file.

type Properties added in v0.4.0

type Properties struct {
	Common   CommonProperties
	Generic  []byte
	Specific []byte
}

Properties contains the object-specific properties.

type PropertiesTable added in v0.4.0

type PropertiesTable []ClassProperties

PropertiesTable is a collection of class-specific properties.

func NewPropertiesTable added in v0.4.0

func NewPropertiesTable(desc Descriptors) PropertiesTable

NewPropertiesTable returns a new instance based on given descriptors.

func StandardPropertiesTable added in v0.4.0

func StandardPropertiesTable() PropertiesTable

StandardPropertiesTable returns a properties table based on the standard configuration of the existing objprop.dat file.

func (PropertiesTable) Code added in v0.4.0

func (table PropertiesTable) Code(coder serial.Coder)

Code serializes the table with given coder.

func (PropertiesTable) ForObject added in v0.4.0

func (table PropertiesTable) ForObject(triple Triple) (Properties, error)

ForObject returns the object-specific properties by given triple.

func (PropertiesTable) Iterate added in v0.4.0

func (table PropertiesTable) Iterate(consumer func(Triple, *Properties) bool)

Iterate walks through all types sequentially and gives the properties to the given consumer. The iteration stops when the consumer returns false or the table has been exhausted.

func (PropertiesTable) TripleIndex added in v0.4.0

func (table PropertiesTable) TripleIndex(triple Triple) int

TripleIndex returns the linear index of the given index.

func (PropertiesTable) TriplesInClass added in v0.4.0

func (table PropertiesTable) TriplesInClass(class Class) []Triple

TriplesInClass returns all triples that are available in the given class.

type RenderType added in v1.0.1

type RenderType byte

RenderType defines how an object is to be rendered.

const (
	RenderTypeUnknown   RenderType = 0
	RenderTypeTextPoly  RenderType = 1
	RenderTypeBitmap    RenderType = 2
	RenderTypeTPoly     RenderType = 3
	RenderTypeCritter   RenderType = 4
	RenderTypeAnimPoly  RenderType = 5
	RenderTypeVox       RenderType = 6
	RenderTypeNoObject  RenderType = 7
	RenderTypeTexBitmap RenderType = 8
	RenderTypeFlatPoly  RenderType = 9
	RenderTypeMultiView RenderType = 10
	RenderTypeSpecial   RenderType = 11
	RenderTypeTLPoly    RenderType = 12
)

RenderType constants.

type Subclass

type Subclass byte

Subclass divides an object class.

type SubclassDescriptor added in v0.4.0

type SubclassDescriptor struct {
	// TypeCount specifies how many types exist in this subclass.
	TypeCount int
	// SpecificDataSize specifies the length, in bytes, of one specific type entry.
	SpecificDataSize int
}

SubclassDescriptor describes one subclass.

func (SubclassDescriptor) TotalDataSize added in v0.4.0

func (desc SubclassDescriptor) TotalDataSize() int

TotalDataSize returns the total length, in bytes, the subclass requires in the properties file.

type SubclassProperties added in v0.4.0

type SubclassProperties []Properties

SubclassProperties is a collection of type-specific properties.

type Triple

type Triple struct {
	Class    Class
	Subclass Subclass
	Type     Type
}

Triple identifies one specific object by its full coordinate.

func TripleFrom

func TripleFrom(class, subclass, objType int) Triple

TripleFrom returns a Triple instance with given values as coordinates.

func TripleFromInt added in v0.4.0

func TripleFromInt(value int) Triple

TripleFromInt returns a Triple instance based on a single integer value.

func (Triple) Int added in v0.4.0

func (triple Triple) Int() int

Int returns the triple as a single integer value.

func (Triple) String

func (triple Triple) String() string

String returns the textual representation of the triple as "cl/s/ty" string.

type Type

type Type byte

Type describes one specific object.

Jump to

Keyboard shortcuts

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