Documentation ¶
Overview ¶
Package object contains the game-global properties of objects.
Index ¶
- Constants
- func Pivot(prop CommonProperties) float32
- type Class
- type ClassDescriptor
- type ClassProperties
- type CommonProperties
- type Descriptors
- type Properties
- type PropertiesTable
- func (table PropertiesTable) Code(coder serial.Coder)
- func (table PropertiesTable) ForObject(triple Triple) (Properties, error)
- func (table PropertiesTable) Iterate(consumer func(Triple, *Properties) bool)
- func (table PropertiesTable) TripleIndex(triple Triple) int
- func (table PropertiesTable) TriplesInClass(class Class) []Triple
- type RenderType
- type Subclass
- type SubclassDescriptor
- type SubclassProperties
- type Triple
- type Type
Constants ¶
const (
// ClassCount describes how many object classes there are.
ClassCount = 15
)
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.
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 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 ¶
Triple identifies one specific object by its full coordinate.
func TripleFrom ¶
TripleFrom returns a Triple instance with given values as coordinates.
func TripleFromInt ¶ added in v0.4.0
TripleFromInt returns a Triple instance based on a single integer value.