data

package
v0.0.0-...-55c2232 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APCastSpell           ActionPointEnum = 0
	APWalk                                = 1
	APRun                                 = 2
	APTurn                                = 3
	APCrouch                              = 4
	APStand                               = 5
	APOpenDoor                            = 6
	APDropItem                            = 7
	APPickupItem                          = 8
	APThrowItem                           = 9
	APUseMedikit                          = 10
	APUseScanner                          = 11
	APJump                                = 12
	APThrowGrenade                        = 13
	APHalfTurn                            = 14
	APToClearJammedWeapon                 = 15
	APHandToHandRound                     = 16
	APToUseSwitch                         = 17
	APToUseKey                            = 18
	APToBoardDisembark                    = 19
	APWhenOnFire                          = 20
	APWhenBroken                          = 21
	APMax                                 = 22

	SettingOccasionalSoundPercent            SettingEnum = 0
	SettingOccasionalMovementSound                       = 1
	SettingFullJumpFuel                                  = 2
	SettingMaxJumpDistance                               = 3
	SettingFlyFramesPerCell                              = 4
	SettingPowerArmorRating                              = 5
	SettingTerminatorArmorRating                         = 6
	SettingBloodThirsterArmorRating                      = 7
	SettingDemonicArmorRating                            = 8
	SettingPrimitiveArmorRating                          = 9
	SettingHorrorArmorRating                             = 10
	SettingArmorDice                                     = 11
	SettingJumpPixelsPerFrame                            = 12
	SettingCharacterAnimationDelay                       = 13
	SettingVehicleAnimationDelay                         = 14
	SettingLoopingEffectsDelay                           = 15
	SettingFireAnimationDelay                            = 16
	SettingCharacterFireTransparency                     = 17
	SettingMissileDrawOffset                             = 18 // pixels per missing piece
	SettingWeaponJamPercent                              = 19 // to two decimal places
	SettingScanFrequency                                 = 20
	SettingCoverSearchRadius                             = 21
	SettingDialogAutoCloseTime                           = 22
	SettingPointBlankBallisticSkillBonus                 = 23
	SettingPointBlankRange                               = 24
	SettingMinimumOverwatchShotPercent                   = 25
	SettingMultipleSekectDragTolerance                   = 26
	SettingStandingGuardPostRadius                       = 27
	SettingMaxDemonFlyDistance                           = 28
	SettingSpellLoopingVolume                            = 29 // percentage, 0 decimal places
	SettingPercentOfChaosInSecondaryQuadrant             = 30
	SettingNumberOfRandomCrates                          = 31
	SettingMax                                           = 32

	TFDeletedVehicle   TransitionFrameEnum = 0
	TFUltraRhino                           = 1
	TFUltraPredator                        = 2
	TFUltraLandSpeeder                     = 3
	TFUltraDreadnought                     = 4
	TFChaosRhino                           = 5
	TFChaosPredator                        = 6
	TFChaosDreadnought                     = 7
	TFMax                                  = 8

	SquadTerminator        SquadTypeEnum = 0
	SquadTactical                        = 1
	SquadAssault                         = 2
	SquadDevastator                      = 3
	SquadChaos                           = 4
	SquadChaosKhorne                     = 5
	SquadChaosTerminator                 = 6
	SquadChaosCultise                    = 7
	SquadLibrarian                       = 8
	SquadTechmarine                      = 9
	SquadApothecary                      = 10
	SquadChaplain                        = 11
	SquadCaptain                         = 12
	SquadChaosLord                       = 13
	SquadChaosChaplain                   = 14
	SquadChaosSorcerer                   = 15
	SauadChaosBlodThirster               = 16
	SquadChaosBlootLetter                = 17
	SquadChaosFleshHound                 = 18
	SquadChaosLordOfChange               = 19
	SquadChaosFlamer                     = 20
	SquadChaosPinkHorror                 = 21
	SquadChaosBlueHorror                 = 22
	SquadMax                             = 23

	VehicleUltraRhino       VehicleTypeEnum = 0
	VehicleUltraPredator                    = 1
	VehicleUltraLandSpeeder                 = 2
	VehicleUltraDreadnought                 = 3
	VehicleChaosRhino                       = 4
	VehicleChaosPredator                    = 5
	VehicleChaosDreadnought                 = 6
	VehicleMax                              = 7

	OptionMovies               OptionEnum = 0
	OptionMusic                           = 1
	OptionCombatVoices                    = 2
	OptionGrid                            = 3
	OptionShowPaths                       = 4
	OptionPointSave                       = 5
	OptionAutoCutLevel                    = 6
	OptionShowUnitAnimations              = 7
	OptionCombatResolution                = 8
	OptionMusicVolume                     = 9  // percentage, 0df
	OptionSoundEffectsVolume              = 10 // percentage, 0df
	OptionUnitAnimationSpeed              = 11 // percentage, 0df, see CHARCTER ANIMATION DELAY / VEHICLE ANIMATION DELAY for worst case value
	OptionEffectAnimationSpeed            = 12 // percentage, 0d, see LOOPING_EFFECTS_DELAY for worst case value
	OptionMax                             = 13

	SpellHellfire           SpellEnum = 0
	SpellLightningArc                 = 1
	SpellGate                         = 2
	SpellAssail                       = 3
	SpellDisplacement                 = 4
	SpellMachineCurse                 = 5
	SpellScan                         = 6
	SpellQuickening                   = 7
	SpellStrengthOfMind               = 8
	SpellSmite                        = 9
	SpellIronArm                      = 10
	SpellSalamandar                   = 11
	SpellTeleport                     = 12
	SpellPsychicShield                = 13
	SpellDestroyDemon                 = 14
	SpellHolocaust                    = 15
	SpellScourge                      = 16
	SpellPurge                        = 17
	SpellAuraOfFire                   = 18
	SpellVortex                       = 19
	SpellStormOfWrath                 = 20
	SpellAuraOfFortitude              = 21
	SpellPinkFireOfTzeentch           = 22
	SpellBoltOfChange                 = 23
	SpellTzeentchFireStore            = 24
	SpellMax                          = 25

	AIPrioritySpecialCharacter = 0
	AIPriorityVehicle          = 1
	AIPriorityTerminator       = 2
	AIPriorityHeavyWeapon      = 3
	AIPriorityRegular          = 4
	AIPriorityCultist          = 5
	AIPriorityMax              = 6

	RngRangeVehicleHillHeight           RngRangeEnum = 0
	RngRangeVehicleHillWidth                         = 1
	RngRangeVehicleHillDensity                       = 2
	RngRangeVehicleLargeObjectDensity                = 3
	RngRangeVehicleSmallObjectDensity                = 4
	RngRangeNoVehicleHillHeight                      = 5
	RngRangeNoVehicleHillWidth                       = 6
	RngRangeNoVehicleHillDensity                     = 7
	RngRangeNoVehicleLargeObjectDensity              = 8
	RngRangeNoVehicleSmallObjectDensity              = 9
	RngRangeMax                                      = 10

	// FIXME: is this really a hardcoded value?
	NumCampaignScenarios = 15
)
View Source
const (
	AnimActionNone             AnimAction = 0
	AnimActionAnim             AnimAction = 1
	AnimActionWalk             AnimAction = 2
	AnimActionExplosion        AnimAction = 3
	AnimActionProjectile       AnimAction = 4
	AnimActionSmoke            AnimAction = 5
	AnimActionStandingShoot    AnimAction = 6
	AnimActionStandingDeath    AnimAction = 7
	AnimActionPain             AnimAction = 8
	AnimActionSpellFx1         AnimAction = 9
	AnimActionSpellFx2         AnimAction = 10
	AnimActionSpellFx3         AnimAction = 11
	AnimActionSpellFx4         AnimAction = 12
	AnimActionSpellFx5         AnimAction = 13
	AnimActionRun              AnimAction = 14
	AnimActionCrouch           AnimAction = 15
	AnimActionStand            AnimAction = 16
	AnimActionStandingReady    AnimAction = 17
	AnimActionStandingUnready  AnimAction = 18
	AnimActionCrouchingReady   AnimAction = 19
	AnimActionCrouchingUnready AnimAction = 20
	AnimActionCrouchingShoot   AnimAction = 21
	AnimActionStandingGrenade  AnimAction = 22
	AnimActionCrouchingGrenade AnimAction = 23
	AnimActionDrawMelee        AnimAction = 24
	AnimActionSlash            AnimAction = 25
	AnimActionStab             AnimAction = 26
	AnimActionBlown            AnimAction = 27
	AnimActionCrouchingDeath   AnimAction = 28
	AnimActionJump             AnimAction = 29
	AnimActionHeal             AnimAction = 30
	AnimActionTechWork         AnimAction = 31
	AnimActionCast             AnimAction = 32
	AnimActionShoot            AnimAction = 33
	AnimActionDeath            AnimAction = 34
	AnimActionFromWarp         AnimAction = 35

	AnimActionStart = AnimActionNone
	AnimActionEnd   = AnimActionFromWarp
	AnimActionCount = AnimActionEnd - AnimActionStart + 1

	// FIXME: indexed from 1, very annoying
	CharacterTypeTactical        CharacterType = 1
	CharacterTypeAssault         CharacterType = 2
	CharacterTypeDevastator      CharacterType = 3
	CharacterTypeTerminator      CharacterType = 4
	CharacterTypeApothecary      CharacterType = 5
	CharacterTypeTechmarine      CharacterType = 6
	CharacterTypeChaplain        CharacterType = 7
	CharacterTypeLibrarian       CharacterType = 8
	CharacterTypeCaptain         CharacterType = 9
	CharacterTypeChaosMarine     CharacterType = 10
	CharacterTypeChaosLord       CharacterType = 11
	CharacterTypeChaosChaplain   CharacterType = 12
	CharacterTypeChaosSorcerer   CharacterType = 13
	CharacterTypeChaosTerminator CharacterType = 14
	CharacterTypeKhorneBerserker CharacterType = 15
	CharacterTypeBloodThirster   CharacterType = 16
	CharacterTypeBloodLetter     CharacterType = 17
	CharacterTypeFleshHound      CharacterType = 18
	CharacterTypeLordOfChange    CharacterType = 19
	CharacterTypeFlamer          CharacterType = 20
	CharacterTypePinkHorror      CharacterType = 21
	CharacterTypeBlueHorror      CharacterType = 22
	CharacterTypeChaosCultist    CharacterType = 23

	CharacterTypeStart = CharacterTypeTactical
	CharacterTypeEnd   = CharacterTypeChaosCultist
	CharacterTypeCount = CharacterTypeEnd - CharacterTypeStart + 1
)
View Source
const (
	I18nFile = "USEng.dta"
)

FIXME: this should be put into the config file maybe, or detected from a list of possibilities?

Variables

This section is empty.

Functions

func LoadObjects

func LoadObjects(dir string) (map[string]*Object, error)

Types

type AIPriorityEnum

type AIPriorityEnum int // FIXME: no idea what this is for

type Accounting

type Accounting map[string]string

func LoadAccounting

func LoadAccounting(filename string) (Accounting, error)

type ActionPointEnum

type ActionPointEnum int

type AnimAction

type AnimAction int

AnimAction represents an animation that is stored in WarHammer.ani

func (AnimAction) String

func (a AnimAction) String() string

type AnimatedObject

type AnimatedObject struct {
	CentreCell     Cell
	Direction      int
	Type           int
	AnimationID    int
	AnimationGroup int
	AnimatedType   int
	AnimationIDs   CompassPoints // 8 of these, down to MoveBits. Compass points?
	InCells        CompassPoints
	VisualBits     CompassPoints
	MoveBits       CompassPoints
	Visibility     int
	Protection     int
	MinDelay       int // in milliseconds
	DelayRange     int // in milliseconds
}

func LoadAnimatedObjectDefinitions

func LoadAnimatedObjectDefinitions(filename string) ([]AnimatedObject, error)

type Cell

type Cell struct {
	X int // FIXME: This is just a guess, but I think it's a 3D coordinate system
	Y int
	Z int
}

type CharacterType

type CharacterType int

CharacterType represents one of the different types of character in the game.

TODO: can we load the list of character types anywhere or is it hardcoded in the original too?

func (CharacterType) String

func (c CharacterType) String() string

type CompassPoints

type CompassPoints struct {
	N  int
	NE int
	E  int
	SE int
	S  int
	SW int
	W  int
	NW int
}

type Entry

type Entry struct {
	Text string
	Help string
}

I18n entries may have 1 or 2 items. If two, the first is a menu item and the second is a help string for that menu item.

The text or help may contain some magic strings, as mentioned in USEng.data

type Generic

type Generic struct {
	ActionPoints                map[ActionPointEnum]int
	Settings                    map[SettingEnum]int
	VehicleWalkTransitionFrames map[TransitionFrameEnum]CompassPoints
	MPChooseUnitSquadLimits     map[SquadTypeEnum]int

	// I'm assuming this is to do with MP becauses squads are. I could be wrong.
	MPChooseVehicleLimits map[VehicleTypeEnum]int

	Options map[OptionEnum]int

	CampaignMaps           []string
	CampaignEndMissionWavs []string

	AICoherentForce                       int               // Range that defnines a coherent for for the AI. No idea
	AISpellDeltaPriorityWeights           map[SpellEnum]int // AI delta priority weights for each spell
	AIPriority                            map[AIPriorityEnum]int
	AICommandInfiniteLoopCounterWatermark int // Messing with this can cripple the API...

	RngRanges map[RngRangeEnum]Range
}

func LoadGeneric

func LoadGeneric(filename string) (*Generic, error)

TODO: consume these values from the file

type HasAction

type HasAction struct {
	// contains filtered or unexported fields
}

HasAction tells us whether a character has an animation or not.

func LoadHasAction

func LoadHasAction(filename string) (*HasAction, error)

func (*HasAction) Actions

func (h *HasAction) Actions(c CharacterType) []AnimAction

Actions returns the list of animations that a character type has

func (*HasAction) Check

func (h *HasAction) Check(c CharacterType, a AnimAction) bool

func (*HasAction) Index

func (h *HasAction) Index(c CharacterType, requestedAction AnimAction) int

FIXME: Too slow

func (*HasAction) Print

func (h *HasAction) Print()

type I18n

type I18n struct {
	Name string
	// contains filtered or unexported fields
}

WH40K has basic text internationalisation capabilities based on a <lang>.dta file that maps string IDs to messages

func LoadI18n

func LoadI18n(filename string) (*I18n, error)

func (*I18n) Len

func (n *I18n) Len() int

func (*I18n) ReplaceHelp

func (n *I18n) ReplaceHelp(in int, out *string)

func (*I18n) ReplaceText

func (n *I18n) ReplaceText(in int, out *string)

Puts the internationalized string into `out` if `in` matches a known ID

type Object

type Object struct {
	ObjectHeader

	Filename string
	Name     string // left blank for use by you
	Sprites  []*Sprite
}

func LoadObject

func LoadObject(filename string) (*Object, error)

func LoadObjectLazily

func LoadObjectLazily(filename string) (*Object, error)

func (*Object) LoadAllSprites

func (o *Object) LoadAllSprites() error

func (*Object) LoadSprite

func (o *Object) LoadSprite(idx int) error

type ObjectHeader

type ObjectHeader struct {
	NumSprites uint32 // How many sprites does this object have?
	DirOffset  uint32 // Offset of the directory block
	DirSize    uint32 // Size of the directory block. 8 * NumSprites
	DataOffset uint32 // Offset of the sprite data block
	DataSize   uint32 // Size of the sprite data block
}

ObjectHeader totals 24 bytes on disk

func (ObjectHeader) Check

func (h ObjectHeader) Check() error

func (ObjectHeader) ExpectedDirSize

func (h ObjectHeader) ExpectedDirSize() uint32

type OptionEnum

type OptionEnum int // differs from settings in that these are defaults changeable from the UI

type Range

type Range struct {
	Start int
	End   int
}

type RngRangeEnum

type RngRangeEnum int

type SettingEnum

type SettingEnum int

type SpellEnum

type SpellEnum int

type Sprite

type Sprite struct {
	SpriteHeader

	Data []byte
}

func (*Sprite) ToImage

func (s *Sprite) ToImage(palette color.Palette) *image.Paletted

type SpriteHeader

type SpriteHeader struct {
	XOffset   uint16
	YOffset   uint16
	Width     uint16
	Height    uint16
	Padding1  uint32 // I don't think this is used. Could be wrong.
	PixelSize uint32
	Unknown1  [4]byte // ??? Only observed in `WarHammer.ani` so far
	Padding2  uint32  // I don't think this is used either. Could be wrong.
}

func (SpriteHeader) Check

func (s SpriteHeader) Check(expectedSize uint32) error

type SquadTypeEnum

type SquadTypeEnum int // just for the multiplayer choose units menu

type TransitionFrameEnum

type TransitionFrameEnum int

type VehicleTypeEnum

type VehicleTypeEnum int // just for the multiplayer choose units screen

Directories

Path Synopsis
Package rle implements the run-length encoding scheme discovered in Chaos Gate .obj files.
Package rle implements the run-length encoding scheme discovered in Chaos Gate .obj files.

Jump to

Keyboard shortcuts

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