object

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 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 (

	// Bitmap3DBitmapNumberLimit is the maximum amount of bitmaps.
	Bitmap3DBitmapNumberLimit uint16 = 0x07FF
	// Bitmap3DFrameNumberLimit is the maximum amount of frames.
	Bitmap3DFrameNumberLimit uint16 = 0x0007
)
View Source
const (
	// CommonPropertiesSize specifies, in bytes, the length a common properties structure has.
	CommonPropertiesSize = 27

	// HardnessLimit is the maximum hardness value.
	HardnessLimit = 253
	// PhysicsXRLimit is the maximum size value.
	PhysicsXRLimit = 253

	// DefenseNoCriticals is the defense value that prohibits criticals.
	DefenseNoCriticals = 0xFF
	// ToughnessNoDamage is the toughness value that prohibits regular damage.
	ToughnessNoDamage = 3
)
View Source
const (
	// ClassCount describes how many object classes there are.
	ClassCount = 15
)
View Source
const (

	// DestroyEffectValueLimit is the maximum the value can take.
	DestroyEffectValueLimit = destroyEffectValueMask
)
View Source
const (

	// SpecialDamageTypeLimit identifies the maximum value of special damage type
	SpecialDamageTypeLimit = 0x0F
)

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 Bitmap3D added in v1.3.0

type Bitmap3D uint16

Bitmap3D describes how a bitmap object should be represented in 3D world.

func (Bitmap3D) Animation added in v1.3.0

func (bmp Bitmap3D) Animation() bool

Animation returns whether this object is animated.

func (Bitmap3D) BitmapNumber added in v1.3.0

func (bmp Bitmap3D) BitmapNumber() uint16

BitmapNumber returns the number of bitmaps.

func (Bitmap3D) FrameNumber added in v1.3.0

func (bmp Bitmap3D) FrameNumber() uint16

FrameNumber returns the frame number.

func (Bitmap3D) Repeat added in v1.3.0

func (bmp Bitmap3D) Repeat() bool

Repeat returns whether this object repeats its animation.

func (Bitmap3D) WithAnimation added in v1.3.0

func (bmp Bitmap3D) WithAnimation(value bool) Bitmap3D

WithAnimation returns a Bitmap3D with the given value.

func (Bitmap3D) WithBitmapNumber added in v1.3.0

func (bmp Bitmap3D) WithBitmapNumber(value uint16) Bitmap3D

WithBitmapNumber returns a Bitmap3D with the given value.

func (Bitmap3D) WithFrameNumber added in v1.3.0

func (bmp Bitmap3D) WithFrameNumber(value uint16) Bitmap3D

WithFrameNumber returns a Bitmap3D with the given value.

func (Bitmap3D) WithRepeat added in v1.3.0

func (bmp Bitmap3D) WithRepeat(value bool) Bitmap3D

WithRepeat returns a Bitmap3D with the given value.

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 CommonFlag added in v1.3.0

type CommonFlag int

CommonFlag describe flags applicable to all object classes.

const (
	CommonFlagUseful                CommonFlag = 0
	CommonFlagSolid                 CommonFlag = 1
	CommonFlagUsableInventoryObject CommonFlag = 4
	CommonFlagBlockRendering        CommonFlag = 5
	CommonFlagSolidIfClosed         CommonFlag = 8
	CommonFlagFlatSolid             CommonFlag = 9
	CommonFlagDoubledBitmapSize     CommonFlag = 10
	CommonFlagDestroyOnContact      CommonFlag = 11
	CommonFlagClassSpecific1        CommonFlag = 12
	CommonFlagClassSpecific2        CommonFlag = 13
	CommonFlagClassSpecific3        CommonFlag = 14
	CommonFlagUseless               CommonFlag = 15
)

Common flags.

func CommonFlags added in v1.3.0

func CommonFlags() []CommonFlag

CommonFlags returns all known constants.

func (CommonFlag) String added in v1.3.0

func (flag CommonFlag) String() string

String returns the textual representation of the value.

type CommonFlagField added in v1.3.0

type CommonFlagField uint16

CommonFlagField describes simple features applicable for all object classes.

func (CommonFlagField) Has added in v1.3.0

func (field CommonFlagField) Has(flag CommonFlag) bool

Has returns whether the field has given flag set.

func (CommonFlagField) LightType added in v1.3.0

func (field CommonFlagField) LightType() LightType

LightType returns the stored type enumeration value.

func (CommonFlagField) UseMode added in v1.3.0

func (field CommonFlagField) UseMode() UseMode

UseMode returns the stored enumeration value.

func (CommonFlagField) With added in v1.3.0

func (field CommonFlagField) With(flag CommonFlag) CommonFlagField

With returns a new field instance with given flag set.

func (CommonFlagField) WithLightType added in v1.3.0

func (field CommonFlagField) WithLightType(value LightType) CommonFlagField

WithLightType returns a new flag field value with given light type set.

func (CommonFlagField) WithUseMode added in v1.3.0

func (field CommonFlagField) WithUseMode(value UseMode) CommonFlagField

WithUseMode returns a new flag field value with given use mode set.

func (CommonFlagField) Without added in v1.3.0

func (field CommonFlagField) Without(flag CommonFlag) CommonFlagField

Without returns a new field instance without the given flag set.

type CommonProperties added in v0.4.0

type CommonProperties struct {
	Mass         int32
	Hitpoints    int16
	Armor        byte
	RenderType   RenderType
	PhysicsModel PhysicsModel
	Hardness     byte

	PhysicsXR byte

	PhysicsZ               byte
	Vulnerabilities        DamageTypeMask
	SpecialVulnerabilities SpecialDamageType

	Defense       byte
	Toughness     byte
	Flags         CommonFlagField
	MfdOrMeshID   uint16
	Bitmap3D      Bitmap3D
	DestroyEffect DestroyEffect
	// contains filtered or unexported fields
}

CommonProperties are generic ones available for all objects.

type DamageType added in v1.3.0

type DamageType byte

DamageType classifies damage.

const (
	DamageTypeExplosion    DamageType = 0
	DamageTypeEnergy       DamageType = 1
	DamageTypeMagnetic     DamageType = 2
	DamageTypeRadiation    DamageType = 3
	DamageTypeGas          DamageType = 4
	DamageTypeTranquilizer DamageType = 5
	DamageTypeNeedle       DamageType = 6
	DamageTypeBio          DamageType = 7
)

DamageType constants.

func DamageTypes added in v1.3.0

func DamageTypes() []DamageType

DamageTypes returns all known constants.

func (DamageType) String added in v1.3.0

func (damageType DamageType) String() string

String returns the textual representation of the value.

type DamageTypeMask added in v1.3.0

type DamageTypeMask byte

DamageTypeMask combines a set of damage types.

func (DamageTypeMask) Has added in v1.3.0

func (mask DamageTypeMask) Has(dmg DamageType) bool

Has returns whether the mask contains the specified value.

func (DamageTypeMask) With added in v1.3.0

func (mask DamageTypeMask) With(dmg DamageType) DamageTypeMask

With returns a new mask that specifies the combination of this and the given damage type.

func (DamageTypeMask) Without added in v1.3.0

func (mask DamageTypeMask) Without(dmg DamageType) DamageTypeMask

Without returns a new mask that specifies the remainder of this, not including the given type.

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 DestroyEffect added in v1.3.0

type DestroyEffect byte

DestroyEffect is a packed type describing effects during object destruction.

func (DestroyEffect) PlaySound added in v1.3.0

func (effect DestroyEffect) PlaySound() bool

PlaySound returns true if a sound shall be played.

func (DestroyEffect) ShowExplosion added in v1.3.0

func (effect DestroyEffect) ShowExplosion() bool

ShowExplosion returns true if an explosion shall be shown.

func (DestroyEffect) Value added in v1.3.0

func (effect DestroyEffect) Value() byte

Value returns the effect value.

func (DestroyEffect) WithExplosion added in v1.3.0

func (effect DestroyEffect) WithExplosion(value bool) DestroyEffect

WithExplosion returns a new destroy effect that has explosion display marked.

func (DestroyEffect) WithSound added in v1.3.0

func (effect DestroyEffect) WithSound(value bool) DestroyEffect

WithSound returns a new destroy effect that has sound playback marked.

func (DestroyEffect) WithValue added in v1.3.0

func (effect DestroyEffect) WithValue(value byte) DestroyEffect

WithValue returns a new destroy effect with given value.

type LightType added in v1.3.0

type LightType byte

LightType describes how an object is affected by lighting.

const (
	LightTypeSimple   LightType = 0x00
	LightTypeComplex  LightType = 0x01
	LightTypeIgnore   LightType = 0x02
	LightTypeDeferred LightType = 0x03
)

LightType constants.

func LightTypes added in v1.3.0

func LightTypes() []LightType

LightTypes returns all known constants.

func (LightType) String added in v1.3.0

func (mode LightType) String() string

String returns the textual representation of the value.

type PhysicsModel added in v1.3.0

type PhysicsModel byte

PhysicsModel defines how an object can interact with the world.

const (
	PhysicsModelInsubstantial PhysicsModel = 0
	PhysicsModelRegular       PhysicsModel = 1
	PhysicsModelStrange       PhysicsModel = 2
)

PhysicsModel constants.

func PhysicsModels added in v1.3.0

func PhysicsModels() []PhysicsModel

PhysicsModels returns all known constants.

func (PhysicsModel) String added in v1.3.0

func (model PhysicsModel) String() string

String returns the textual representation of the value.

type Properties added in v0.4.0

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

Properties contains the object-specific properties.

func (Properties) Clone added in v1.3.0

func (prop Properties) Clone() Properties

Clone returns a fresh instance with a copy of the data.

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.

func RenderTypes added in v1.3.0

func RenderTypes() []RenderType

RenderTypes returns all known constants.

func (RenderType) String added in v1.3.0

func (renderType RenderType) String() string

String returns the textual representation of the value.

type SpecialDamageType added in v1.3.0

type SpecialDamageType byte

SpecialDamageType is a combination of "primary" (double) and "super" (quadruple) damage potential. The identifier are "freeform" enumerations without public constants.

func (SpecialDamageType) PrimaryValue added in v1.3.0

func (dmg SpecialDamageType) PrimaryValue() int

PrimaryValue returns the double damage type.

func (SpecialDamageType) SuperValue added in v1.3.0

func (dmg SpecialDamageType) SuperValue() int

SuperValue returns the quadruple damage type.

func (SpecialDamageType) WithPrimaryValue added in v1.3.0

func (dmg SpecialDamageType) WithPrimaryValue(value int) SpecialDamageType

WithPrimaryValue returns a new type instance with the given primary value set.

func (SpecialDamageType) WithSuperValue added in v1.3.0

func (dmg SpecialDamageType) WithSuperValue(value int) SpecialDamageType

WithSuperValue returns a new type instance with the given super value set.

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.

type UseMode added in v1.3.0

type UseMode byte

UseMode describes how an object can be interacted with.

const (
	UseModePickup UseMode = 0x00
	UseModeUse    UseMode = 0x01
	UseModeNull   UseMode = 0x03
)

UseMode constants.

func UseModes added in v1.3.0

func UseModes() []UseMode

UseModes returns all known constants.

func (UseMode) String added in v1.3.0

func (mode UseMode) String() string

String returns the textual representation of the value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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