bg

package
v0.0.0-...-bfc2e8c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: BSD-2-Clause Imports: 31 Imported by: 0

Documentation

Overview

Package ini provides functions for parsing INI configuration files.

Index

Constants

View Source
const (
	BUTTON_FLAGS_LEFTALIGN      = 0x01
	BUTTON_FLAGS_RIGHTALIGN     = 0x02
	BUTTON_FLAGS_TOPALIGN       = 0x04
	BUTTON_FLAGS_BOTTOMALIGN    = 0x08
	BUTTON_FLAGS_USEREFPT       = 0x10
	BUTTON_FLAGS_LOWERCASELABEL = 0x20
	BUTTON_FLAGS_NOWORDWRAP     = 0x40
)
View Source
const (
	IDS_UNKNOWN = iota
	IDS_OBJECT
	IDS_ACTION
	IDS_STRING
	IDS_POINT
	IDS_INT
)
View Source
const (
	TEXT_PRESENT  = 1
	SOUND_PRESENT = 2
	TOKEN_PRESENT = 4
)
View Source
const BLK_X_2BPP uint32 = 8 // dimensions for the two formats
View Source
const BLK_X_4BPP uint32 = 4
View Source
const BLK_X_MAX uint32 = 8 // Max X dimension for blocks
View Source
const BLK_Y_SIZE uint32 = 4 // always 4 for all 2D block types
View Source
const DXT_MIN_TEXHEIGHT uint32 = 4
View Source
const DXT_MIN_TEXWIDTH uint32 = 4
View Source
const ETC_MIN_TEXHEIGHT uint32 = 4
View Source
const ETC_MIN_TEXWIDTH uint32 = 4
View Source
const (
	NUM_ATTACK_TYPES = 6
)
View Source
const PT_INDEX uint32 = 2 // The Punch-through index

****************************************************************************

  • defines and consts ****************************************************************************
View Source
const PVRTC2_MIN_TEXHEIGHT uint32 = 8
View Source
const PVRTC2_MIN_TEXWIDTH uint32 = 16
View Source
const PVRTC4_MIN_TEXHEIGHT uint32 = 8
View Source
const PVRTC4_MIN_TEXWIDTH uint32 = 8
View Source
const PVRTEX_ALPHA uint32 = (1 << 15) // v2.1 is there transparency info in the texture
View Source
const PVRTEX_BUMPMAP uint32 = (1 << 10) // has normals encoded for a bump map
View Source
const PVRTEX_CUBEMAP uint32 = (1 << 12) // is a cubemap/skybox
View Source
const PVRTEX_FALSEMIPCOL uint32 = (1 << 13) // are there false coloured MIP levels
View Source
const PVRTEX_IDENTIFIER uint32 = 0x21525650 // the pvr identifier is the characters 'P','V','R'
View Source
const PVRTEX_MIPMAP uint32 = (1 << 8) // has mip map levels
View Source
const PVRTEX_PIXELTYPE uint32 = 0xff // pixel type is always in the last 16bits of the flags
View Source
const PVRTEX_TILING uint32 = (1 << 11) // is bordered for tiled pvr
View Source
const PVRTEX_TWIDDLE uint32 = (1 << 9) // is twiddled
View Source
const PVRTEX_V1_HEADER_SIZE uint32 = 44 // old header size was 44 for identification purposes
View Source
const PVRTEX_VERTICAL_FLIP uint32 = (1 << 16) // v2.1 is the texture vertically flipped
View Source
const PVRTEX_VOLUME uint32 = (1 << 14) // is this a volume texture

Variables

View Source
var DisableTwiddlingRoutine int = 0

!***********************************************************************

 @Function		TwiddleUV
 @Input			YSize	Y dimension of the texture in pixels
 @Input			XSize	X dimension of the texture in pixels
 @Input			YPos	Pixel Y position
 @Input			XPos	Pixel X position
 @Returns		The twiddled offset of the pixel
 @Description	Given the Block (or pixel) coordinates and the dimension of
				the texture in blocks (or pixels) this returns the twiddled
				offset of the block (or pixel) from the start of the map.

				NOTE the dimensions of the texture must be a power of 2

************************************************************************

Functions

func ColorInPalette

func ColorInPalette(color color.Color, palette color.Palette) bool

func ConvertToBIFL

func ConvertToBIFL(r io.ReadSeeker, w io.WriteSeeker) error

func Decompress

func Decompress(pCompressedData []uint32,
	Do2bitMode bool,
	XDim uint32,
	YDim uint32,
	AssumeImageTiles bool,
	pResultImage []uint8)

!***********************************************************************

@Function		Decompress
@Input			pCompressedData The PVRTC texture data to decompress
@Input			Do2BitMode Signifies whether the data is PVRTC2 or PVRTC4
@Input			XDim X dimension of the texture
@Input			YDim Y dimension of the texture
@Input			AssumeImageTiles Assume the texture data tiles
@Modified		pResultImage The decompressed texture data
@Description	Decompresses PVRTC to RGBA 8888

************************************************************************

func DecompressBlockDXT1Internal

func DecompressBlockDXT1Internal(block []uint8, img *image.RGBA, pt image.Point)

func DecompressBlockDXT5Internal

func DecompressBlockDXT5Internal(blockStorage []uint8, img *image.RGBA, pt image.Point)

func GetModulationValue

func GetModulationValue(x uint32,
	y uint32,
	Do2bitMode bool,
	ModulationVals [8][16]uint32,
	ModulationModes [8][16]uint32,
	Mod *uint32,
	DoPT *uint32)

!***********************************************************************

@Function		GetModulationValue
@Input			x
@Input			y
@Input			Do2bitMode
@Input			ModulationVals
@Input			ModulationModes
@Input			Mod
@Input			DoPT
@Description	Get the modulation value as a numerator of a fraction of 8ths

************************************************************************

func InterpolateColours

func InterpolateColours(ColourP [4]uint32,
	ColourQ [4]uint32,
	ColourR [4]uint32,
	ColourS [4]uint32,
	Do2bitMode bool,
	x uint32,
	y uint32,
	Result *[4]uint32)

!***********************************************************************

 @Function		InterpolateColours
 @Input			ColourP
 @Input			ColourQ
 @Input			ColourR
 @Input			ColourS
 @Input			Do2bitMode
 @Input			x
 @Input			y
 @Modified		Result
 @Description	This performs a HW bit accurate interpolation of either the
				A or B colours for a particular pixel.

				NOTE: It is assumed that the source colours are in ARGB 5554
				format - This means that some "preparation" of the values will
				be necessary.

************************************************************************

func LIMIT_COORD

func LIMIT_COORD(Val, Size uint32, AssumeImageTiles bool) uint32

func NewPVRTexture

func NewPVRTexture(r io.ReadSeeker) (*tisPvrTexture, error)

func NewPathScanner

func NewPathScanner(path string, mode int) svgPathScanner

func OpenEff

func OpenEff(r io.ReadSeeker) (*ItmEffect, *EffEffect, error)

func RepackageBiff

func RepackageBiff(keyFile io.ReadSeeker, bifIn io.ReadSeeker, filesPath string, bifOutPath string) error

func TwiddleUV

func TwiddleUV(YSize uint32, XSize uint32, YPos uint32, XPos uint32) uint32

func Unpack5554Colour

func Unpack5554Colour(pBlock []uint32, ABColours *[2][4]uint32)

!***********************************************************************

 @Function		Unpack5554Colour
 @Input			pBlock
 @Input			ABColours
 @Description	Given a block, extract the colour information and convert
				to 5554 formats

************************************************************************

func UnpackModulations

func UnpackModulations(pBlock []uint32,
	Do2bitMode bool,
	ModulationVals *[8][16]uint32,
	ModulationModes *[8][16]uint32,
	StartX uint32,
	StartY uint32)

!***********************************************************************

 @Function		UnpackModulations
 @Input			pBlock
 @Input			Do2bitMode
 @Input			ModulationVals
 @Input			ModulationModes
 @Input			StartX
 @Input			StartY
 @Description	Given the block and the texture type and it's relative
				position in the 2x2 group of blocks, extract the bit
				patterns for the fully defined pixels.

************************************************************************

Types

type Area

type Area struct {
	Header           AreaHeader
	Offsets          AreaFileOffsets `json:"-"`
	Actors           []AreaActor
	Regions          []AreaRegion
	SpawnPoints      []AreaSpawnPoint
	Entrances        []AreaEntrance
	Containers       []AreaContainer
	Items            []AreaItem
	Vertices         []AreaVertex
	Ambients         []AreaAmbient
	Variables        []AreaVariable
	ExploredBitmask  []byte
	Doors            []AreaDoor
	Animations       []AreaAnimation
	MapNotes         []AreaMapNote
	TiledObjects     []AreaTiledObject
	Traps            []AreaProjectileTrap
	Song             AreaSong
	RestInterruption AreaRestEncounter
}

func OpenArea

func OpenArea(r io.ReadSeeker) (*Area, error)

func (*Area) WriteJson

func (are *Area) WriteJson(w io.Writer) error

type AreaActor

type AreaActor struct {
	Name                LongString
	CurrentX            uint16
	CurrentY            uint16
	DestX               uint16
	DestY               uint16
	Flags               uint32
	Type                uint16
	FirstResSlot        byte
	AlignByte           byte `json:"-"`
	AnimationType       uint32
	Facing              uint16
	AlignWord           uint16 `json:"-"`
	ExpirationTime      uint32
	HuntingRange        uint16
	FollowRange         uint16
	TimeOfDayVisible    uint32
	NumberTimesTalkedTo uint32
	Dialog              Resref
	OverrideScript      Resref
	GeneralScript       Resref
	ClassScript         Resref
	RaceScript          Resref
	DefaultScript       Resref
	SpecificScript      Resref
	CreatureData        Resref
	CreatureOffset      uint32     `json:"-"`
	CreatureSize        uint32     `json:"-"`
	Unused              [32]uint32 `json:"-"`
}

type AreaAmbient

type AreaAmbient struct {
	Name            LongString
	CoordinateX     uint16
	CoordinateY     uint16
	Range           uint16
	Alignment1      uint16 `json:"-"`
	PitchVariance   uint32
	VolumeVariance  uint16
	Volume          uint16
	Sounds          [10]Resref
	SoundCount      uint16
	Alignment2      uint16 `json:"-"`
	Period          uint32
	PeriodVariance  uint32
	TimeOfDayActive uint32
	Flags           uint32
	Unused          [16]uint32 `json:"-"`
}

type AreaAnimation

type AreaAnimation struct {
	Name             LongString
	CoordX           uint16
	CoordY           uint16
	TimeOfDayVisible uint32
	Animation        Resref
	BamSequence      uint16
	BamFrame         uint16
	Flags            uint32
	Height           int16
	Translucency     uint16
	StartFrameRane   uint16
	Probability      byte
	Period           byte
	Palette          Resref
	Unused           uint32 `json:"-"`
}

type AreaContainer

type AreaContainer struct {
	Name                    LongString
	CoordX                  uint16
	CoordY                  uint16
	Type                    uint16
	LockDifficulty          uint16
	Flags                   uint32
	TrapDetectionDifficulty uint16
	TrapRemovalDifficulty   uint16
	ContainerTrapped        uint16
	TrapDetected            uint16
	TrapLaunchX             uint16
	TrapLaunchY             uint16
	BoundingTopLeft         uint16
	BoundingTopRight        uint16
	BoundingBottomRight     uint16
	BoundingBottomLeft      uint16
	ItemOffset              uint32
	ItemCount               uint32
	TrapScript              Resref
	VertexOffset            uint32
	VertexCount             uint16
	TriggerRange            uint16
	OwnedBy                 LongString
	KeyType                 Resref
	BreakDifficulty         uint32
	NotPickableString       uint32
	Unused                  [14]uint32 `json:"-"`
}

type AreaDoor

type AreaDoor struct {
	Name                    LongString
	DoorID                  Resref
	Flags                   uint32
	OpenDoorVertexOffset    uint32 `json:"-"`
	OpenDoorVertexCount     uint16 `json:"-"`
	ClosedDoorVertexCount   uint16 `json:"-"`
	CloseDoorVertexOffset   uint32 `json:"-"`
	OpenBoundingLeft        uint16
	OpenBoundingTop         uint16
	OpenBoundingRight       uint16
	OpenBoundingBottom      uint16
	ClosedBoundingLeft      uint16
	ClosedBoundingTop       uint16
	ClosedBoundingRight     uint16
	ClosedBoundingBottom    uint16
	OpenBlockVertexOffset   uint32 `json:"-"`
	OpenBlockVertexCount    uint16 `json:"-"`
	ClosedBlockVertexCount  uint16 `json:"-"`
	ClosedBlockVertexOffset uint32 `json:"-"`
	HitPoints               uint16
	ArmorClass              uint16
	OpenSound               Resref
	ClosedSound             Resref
	CursorType              uint32
	TrapDetectionDifficulty uint16
	TrapRemovalDifficulty   uint16
	DoorIsTrapped           uint16
	TrapDetected            uint16
	TrapLaunchTargetX       uint16
	TrapLaunchTargetY       uint16
	KeyItem                 Resref
	DoorScript              Resref
	DetectionDifficulty     uint32
	LockDifficulty          uint32
	WalkToX1                uint16
	WalkToY1                uint16
	WalkToX2                uint16
	WalkToY2                uint16
	NotPickableString       uint32
	TriggerName             LongString
	Unused                  [3]uint32 `json:"-"`
}

type AreaEntrance

type AreaEntrance struct {
	Name        LongString
	CoordX      uint16
	CoordY      uint16
	Orientation uint16
	Unused      [66]byte `json:"-"`
}

type AreaFileOffsets

type AreaFileOffsets struct {
	ActorsOffset            uint32
	ActorsCount             uint16
	RegionCount             uint16
	RegionOffset            uint32
	SpawnPointOffset        uint32
	SpawnPointCount         uint32
	EntranceOffset          uint32
	EntranceCount           uint32
	ContainerOffset         uint32
	ContainerCount          uint16
	ItemCount               uint16
	ItemOffset              uint32
	VertexOffset            uint32
	VertexCount             uint16
	AmbientCount            uint16
	AmbientOffset           uint32
	VariableOffset          uint32
	VariableCount           uint16
	TiledObjectFlagCount    uint16
	TiledObjectFlagOffset   uint32
	Script                  Resref
	ExploredSize            uint32
	ExploredOffset          uint32
	DoorsCount              uint32
	DoorsOffset             uint32
	AnimationCount          uint32
	AnimationOffset         uint32
	TiledObjectCount        uint32
	TiledObjectOffset       uint32
	SongEntriesOffset       uint32
	RestInterruptionsOffset uint32
	AutomapOffset           uint32
	AutomapCount            uint32
	ProjectileTrapsOffset   uint32
	ProjectileTrapsCount    uint32
	RestMovieDay            Resref
	RestMovieNight          Resref
	Unknown                 [56]byte `json:"-"`
}

type AreaHeader

type AreaHeader struct {
	Signature, Version   [4]byte `json:"-"`
	AreaWed              Resref
	LastSaved            uint32
	AreaFlags            uint32
	AreaNorth            Resref
	AreaNorthFlags       uint32
	AreaEast             Resref
	AreaEastFlags        uint32
	AreaSouth            Resref
	AreaSouthFlags       uint32
	AreaWest             Resref
	AreaWestFlags        uint32
	Areatype             uint16
	Rainprobability      uint16
	SnowProability       uint16
	FogProbability       uint16
	LightningProbability uint16
	WindSpeed            uint16
}

type AreaItem

type AreaItem struct {
	Resource   Resref
	Expiration uint16
	UsageCount [3]uint16
	Flags      uint32
}

type AreaMapNote

type AreaMapNote struct {
	CoordX uint16
	CoordY uint16
	Note   uint32
	Flags  uint32
	Id     uint32
	Unused [9]uint32
}

type AreaProjectileTrap

type AreaProjectileTrap struct {
	Projectile        Resref
	EffectBlockOffset uint32
	EffectBlockSize   uint16
	MissileId         uint16
	DelayCount        uint16
	RepetitionCount   uint16
	CoordX            uint16
	CoordY            uint16
	CoordZ            uint16
	TargetType        byte
	PortraitNum       byte
}

type AreaRegion

type AreaRegion struct {
	Name                    LongString
	Type                    uint16
	BoundingLeft            uint16
	BoundingTop             uint16
	BoundingRight           uint16
	BoundingBottom          uint16
	VertexCount             uint16
	VertexOffset            uint32
	TriggerValue            uint32
	CursorType              uint32
	Destination             Resref
	EntranceName            LongString
	Flags                   uint32
	InformationText         uint32
	TrapDetectionDifficulty uint16
	TrapDisarmingDifficulty uint16
	TrapActivated           uint16
	TrapDetected            uint16
	TrapOriginX             uint16
	TrapOriginY             uint16
	KeyItem                 Resref
	RegionScript            Resref
	TransitionWalkToX       uint16
	TransitionWalkToY       uint16
	Unused                  [15]uint32 `json:"-"`
}

type AreaRestEncounter

type AreaRestEncounter struct {
	Name                 LongString
	RandomCreatureString [10]uint32
	RandomCreature       [10]Resref
	RandomCreatureNum    uint16
	Difficulty           uint16
	LifeSpan             uint32
	HuntingRange         uint16
	FollowRange          uint16
	MaxTypeNum           uint16
	Activated            uint16
	ProbabilityDay       uint16
	ProbabilityNight     uint16
	Unused               [14]uint32 `json:"-"`
}

type AreaSong

type AreaSong struct {
	DaySong              uint32
	NightSong            uint32
	WinSong              uint32
	BattleSong           uint32
	LoseSong             uint32
	AltMusic0            uint32
	AltMusic1            uint32
	AltMusic2            uint32
	AltMusic3            uint32
	AltMusic4            uint32
	DayAmbient           Resref
	DayAmbientExtended   Resref
	DayAmbientVolume     uint32
	NightAmbient         Resref
	NightAmbientExtended Resref
	NightAmbientVolume   uint32
	Unused               [16]uint32 `json:"-"`
}

type AreaSpawnPoint

type AreaSpawnPoint struct {
	Name                LongString
	CoordX              uint16
	CoordY              uint16
	RandomCreatures     [10]Resref
	RandomCreatureCount uint16
	Difficulty          uint16
	SpawnRate           uint16
	Flags               uint16
	LifeSpan            uint32
	HuntingRange        uint32
	FollowRange         uint32
	MaxTypeNum          uint32
	Activated           uint16
	TimeOfDay           uint32
	ProbabilityDay      uint16
	ProbabilityNight    uint16
	Unused              [14]uint32 `json:"-"`
}

type AreaTiledObject

type AreaTiledObject struct {
	Name                       LongString
	TileID                     Resref
	Flags                      uint32
	PrimarySearchSquareStart   uint32
	PrimarySearchSquareCount   uint16
	SecondarySearchSquareCount uint16
	SecondarySearcHSquareStart uint32
	Unused                     [12]uint32 `json:"-"`
}

type AreaVariable

type AreaVariable struct {
	Name       LongString
	Type       uint16
	ResRefType uint16
	DWValue    uint32
	IntValue   int32
	FloatValue float64
	ScriptName LongString
}

type AreaVertex

type AreaVertex struct {
	Coordinate uint16
}

type BIF

type BIF struct {
	Header          bifHeader
	VariableEntries []bifVarEntry
	FixedEntries    []bifFixedEntry
	// contains filtered or unexported fields
}

func OpenBif

func OpenBif(r io.ReadSeeker) (*BIF, error)

func (*BIF) Print

func (bif *BIF) Print()

func (*BIF) ReadFile

func (bif *BIF) ReadFile(resourceId uint32) ([]byte, error)

type Bam

type Bam struct {
	Image           []image.Paletted
	ImageRgba       []image.RGBA
	Sequences       []BamSequence
	SequenceToImage []int16
	Width           int
	Height          int
	Frames          []BamFrame
	RleFrame        [][]uint8
	Palette         color.Palette
}

func MakeBamFromGif

func MakeBamFromGif(animation *gif.GIF, sequences []image.Point) (*Bam, error)

func OpenBAM

func OpenBAM(r io.ReadSeeker, key *KEY) (*Bam, error)

func OpenBAMD

func OpenBAMD(r io.ReadSeeker, palettePath string) (*Bam, error)

func (*Bam) ExpandAndCenterImages

func (bam *Bam) ExpandAndCenterImages()

func (*Bam) MakeBam

func (bam *Bam) MakeBam(wRaw io.Writer) error

func (*Bam) MakeBamd

func (bam *Bam) MakeBamd(output string, name string, mirror bool, offset_x int, offset_y int)

func (*Bam) MakeGif

func (bam *Bam) MakeGif(outputPath string, name string) error

func (*Bam) MakeSpriteSheet

func (bam *Bam) MakeSpriteSheet(imgWriter io.Writer, jsonWriter io.Writer)

func (*Bam) RebuildSequencesAndDropFrames

func (bam *Bam) RebuildSequencesAndDropFrames()

func (*Bam) WriteJson

func (bam *Bam) WriteJson(w io.Writer) error

type BamCHeader

type BamCHeader struct {
	Signature, Version [4]byte
	UncompressedSize   uint32
}

type BamCycle

type BamCycle struct {
	FrameCount int16
	FrameIndex int16
}

type BamFrame

type BamFrame struct {
	Width, Height    uint16
	CenterX, CenterY int16
	FrameOffset      uint32
}

type BamFrameV2

type BamFrameV2 struct {
	Width, Height    uint16
	CenterX, CenterY int16
	QuadStart        int16
	QuadCount        int16
}

type BamHeader

type BamHeader struct {
	Signature, Version [4]byte
	Frames             uint16
	Cycles             uint8
	CompressedColor    uint8
	FrameOffset        uint32
	PaletteOffset      uint32
	FrameLutOffset     uint32
}

type BamHeaderV2

type BamHeaderV2 struct {
	Signature, Version                         [4]byte
	Frames, Sequences, Quads                   uint32
	FramesOffset, SequencesOffset, QuadsOffset uint32
}

type BamMosaicQuad

type BamMosaicQuad struct {
	Texture            int32
	X, Y, W, H, SX, SY int32
}

type BamSequence

type BamSequence struct {
	Start int
	Count int
}

type CHU

type CHU struct {
	Name   string
	Header chuHeader

	Panels   []chuPanel
	Controls []chuControl
	// contains filtered or unexported fields
}

func DecodeChu

func DecodeChu(r io.ReadSeeker) (*CHU, error)

func (*CHU) OffsetStrings

func (chu *CHU) OffsetStrings()

func (*CHU) PrintResources

func (chu *CHU) PrintResources()

func (*CHU) Write

func (chu *CHU) Write(w io.Writer) error

func (*CHU) WriteMenu

func (chu *CHU) WriteMenu(w io.Writer, name string) error

func (*CHU) WriteSvg

func (chu *CHU) WriteSvg(w io.Writer) error

type CRE

type CRE struct {
	Header               creHeader
	Offsets              creOffsets
	KnownSpells          []creKnownSpell
	MemorizedSpellLevels []creMemorizedSpellLevel
	MemorizedSpells      []creMemorizedSpell
	Effects              []ItmEffect
	Effectsv2            []EffEffect
	Items                []creItem
	Equipment            creEquipment
}

func OpenCre

func OpenCre(r io.ReadSeeker) (*CRE, error)

func (*CRE) Write

func (cre *CRE) Write(w io.Writer) error

func (*CRE) WriteJson

func (cre *CRE) WriteJson(w io.Writer) error

type DLG

type DLG struct {
	Header             dlgHeader
	States             []DlgState
	Transitions        []DlgTransition
	StateTriggers      []string
	TransitionTriggers []string
	Actions            []string
}

func OpenDlg

func OpenDlg(r io.ReadSeeker) (*DLG, error)

func (*DLG) ToJson

func (d *DLG) ToJson(tlk *TLK) ([]byte, error)

func (*DLG) WriteJson

func (dialog *DLG) WriteJson(w io.Writer) error

type DlgState

type DlgState struct {
	Stringref       uint32
	TransitionIndex uint32
	TransitionCount uint32
	TriggerIndex    int32
}

type DlgTransition

type DlgTransition struct {
	Flags                  uint32
	TransitionText         uint32
	JournalText            uint32
	TransitionTriggerIndex uint32
	TransitionActionIndex  uint32
	NextDlg                Resref
	NextState              uint32
}

func (*DlgTransition) AddCompleteQuest

func (trans *DlgTransition) AddCompleteQuest() bool

func (*DlgTransition) AddQuest

func (trans *DlgTransition) AddQuest() bool

func (*DlgTransition) HasAction

func (trans *DlgTransition) HasAction() bool

func (*DlgTransition) HasJournal

func (trans *DlgTransition) HasJournal() bool

func (*DlgTransition) HasText

func (trans *DlgTransition) HasText() bool

func (*DlgTransition) HasTrigger

func (trans *DlgTransition) HasTrigger() bool

func (*DlgTransition) RemoveQuest

func (trans *DlgTransition) RemoveQuest() bool

func (*DlgTransition) TerminatesDialog

func (trans *DlgTransition) TerminatesDialog() bool

type EffEffect

type EffEffect struct {
	Signature, Version [4]byte
	EffectID           uint32
	TargetType         uint32
	SpellLevel         uint32
	EffectAmount       int32
	DWFlags            uint32
	DurationType       uint32
	Duration           uint32
	ProbabilityUpper   uint16
	ProbabilityLower   uint16
	Res                [8]byte
	NumDice            uint32
	DiceSize           uint32
	SavingThrow        uint32
	SaveMod            int32
	Special            uint32

	School   uint32
	Unknown  uint32
	MinLevel uint32
	MaxLevel uint32
	Flags    uint32

	EffectAmount2 int32
	EffectAmount3 int32
	EffectAmount4 int32
	EffectAmount5 int32

	Res2 [8]byte
	Res3 [8]byte

	SourceX        int32
	SourceY        int32
	TargetX        int32
	TargetY        int32
	SourceType     uint32
	SourceRes      [8]byte
	SourceFlags    uint32
	ProjectileType uint32
	SlotNum        int32
	ScriptName     [32]byte
	CasterLevel    uint32
	FirstCall      uint32
	SecondaryType  uint32
	Pad            [15]uint32
}

func (*EffEffect) WriteJson

func (eff *EffEffect) WriteJson(w io.Writer) error

type ErrSyntax

type ErrSyntax struct {
	Line   int
	Source string // The contents of the erroneous line, without leading or trailing whitespace
}

ErrSyntax is returned when there is a syntax error in an INI file.

func (ErrSyntax) Error

func (e ErrSyntax) Error() string

type File

type File map[string]Section

A File represents a parsed INI file.

func LoadFile

func LoadFile(filename string) (File, error)

Loads and returns an INI File from a file on disk.

func OpenINI

func OpenINI(in io.Reader) (File, error)

Loads and returns a File from a reader.

func (File) Get

func (f File) Get(section, key string) (value string, ok bool)

Looks up a value for a key in a section and returns that value, along with a boolean result similar to a map lookup.

func (File) Load

func (f File) Load(in io.Reader) (err error)

Loads INI data from a reader and stores the data in the File.

func (File) LoadFile

func (f File) LoadFile(file string) (err error)

Loads INI data from a named file and stores the data in the File.

func (File) Section

func (f File) Section(name string) Section

Returns a named Section. A Section will be created if one does not already exist for the given name.

type IDS

type IDS struct {
	Entries []idsEntry
}

func OpenIDS

func OpenIDS(r io.ReadSeeker) (*IDS, error)

type ITM

type ITM struct {
	Header    itmHeader
	Abilities []itmAbility
	Effects   []ItmEffect
	Filename  string
}

func OpenITM

func OpenITM(r io.ReadSeeker) (*ITM, error)

func (*ITM) Strings

func (itm *ITM) Strings() map[string]int

func (*ITM) Tp2Block

func (itm *ITM) Tp2Block(baseNum int) (string, []int)

func (*ITM) Write

func (itm *ITM) Write(w io.Writer) error

func (*ITM) WriteJson

func (itm *ITM) WriteJson(w io.Writer) error

type ItmEffect

type ItmEffect struct {
	EffectID         uint16
	TargetType       uint8
	SpellLevel       uint8
	EffectAmount     int32
	Flags            uint32
	DurationType     uint16
	Duration         uint32
	ProbabilityUpper uint8
	ProbabilityLower uint8
	Res              Resref
	NumDice          uint32
	DiceSize         uint32
	SavingThrow      uint32
	SaveMod          int32
	Special          uint32
}

func (*ItmEffect) WriteJson

func (eff *ItmEffect) WriteJson(w io.Writer) error

type JsonWed

type JsonWed struct {
	Overlays    []jsonWedOverlay
	Doors       []jsonWedDoor
	Walls       []jsonWedPolygon `json:"-"`
	TileIndices []int            `json:"-"`
}

func CreateJWed

func CreateJWed(width int, height int, name string) (*JsonWed, error)

func OpenJWed

func OpenJWed(r io.ReadSeeker) (*JsonWed, error)

func (*JsonWed) Export

func (jw *JsonWed) Export(name string, dir string) error

func (*JsonWed) GenerateWallPolys

func (jw *JsonWed) GenerateWallPolys() ([]wedPolygon, []wedVertex, []uint16, []wedWallGroup)

func (*JsonWed) ImportDoors

func (jw *JsonWed) ImportDoors(wed *Wed)

func (*JsonWed) ImportOverlays

func (jw *JsonWed) ImportOverlays(wed *Wed) error

func (*JsonWed) ImportWalls

func (jw *JsonWed) ImportWalls(wed *Wed)

func (*JsonWed) ToJson

func (jw *JsonWed) ToJson() (string, error)

func (*JsonWed) ToWed

func (jw *JsonWed) ToWed() (*Wed, error)

type KEY

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

func OpenKEY

func OpenKEY(r io.ReadSeeker, root string) (*KEY, error)

func (*KEY) Explode

func (key *KEY) Explode(dir string) error

func (*KEY) ExtToType

func (key *KEY) ExtToType(ext string) int

func (*KEY) GetBifId

func (key *KEY) GetBifId(bifPath string) int

func (*KEY) GetBifPath

func (key *KEY) GetBifPath(bifId uint32) (string, error)

func (*KEY) GetFilesByType

func (key *KEY) GetFilesByType(ext int) []string

func (*KEY) GetResourceName

func (key *KEY) GetResourceName(biffId uint32, resourceId uint32) (string, error)

func (*KEY) OpenFile

func (key *KEY) OpenFile(name string) ([]byte, error)

func (*KEY) Print

func (key *KEY) Print()

func (*KEY) TypeToExt

func (key *KEY) TypeToExt(ext uint16) string

func (*KEY) Validate

func (key *KEY) Validate()

type KeyHeader

type KeyHeader keyHeader

type LongString

type LongString struct {
	Value [32]byte
}

func (*LongString) MarshalJSON

func (r *LongString) MarshalJSON() ([]byte, error)

func (*LongString) String

func (r *LongString) String() string

type MedianCutQuantizer

type MedianCutQuantizer struct {
	NumColor int
	Points   []point
}

MedianCutQuantizer constructs a palette with a maximum of NumColor colors by iteratively splitting clusters of color points mapped on a three-dimensional (RGB) Euclidean space. Once the number of clusters is within the specified bounds, the resulting color is computed by averaging those within each grouping.

func (*MedianCutQuantizer) AddPoint

func (q *MedianCutQuantizer) AddPoint(r, g, b int)

func (*MedianCutQuantizer) MedianCut

func (q *MedianCutQuantizer) MedianCut() color.Palette

func (*MedianCutQuantizer) Quantize

func (q *MedianCutQuantizer) Quantize(dst *image.Paletted, r image.Rectangle, src image.Image, sp image.Point)

type Resref

type Resref struct {
	Name [8]byte
}

func NewResref

func NewResref(name string) Resref

func (*Resref) MarshalJSON

func (r *Resref) MarshalJSON() ([]byte, error)

func (Resref) String

func (r Resref) String() string

func (*Resref) Valid

func (r *Resref) Valid() bool

type SPL

type SPL struct {
	Header    splHeader
	Abilities []splAbility
	Effects   []ItmEffect
	Filename  string
}

func OpenSPL

func OpenSPL(r io.ReadSeeker) (*SPL, error)

func (*SPL) Write

func (spl *SPL) Write(w io.Writer) error

func (*SPL) WriteJson

func (spl *SPL) WriteJson(w io.Writer) error

type STRREF

type STRREF uint32

type Section

type Section map[string]string

A Section represents a single section of an INI file.

type SvgFile

type SvgFile struct {
	XMLName xml.Name   `xml:"svg"`
	Width   int        `xml:"width,attr"`
	Height  int        `xml:"height,attr"`
	Groups  []SvgGroup `xml:"g"`
}

func OpenSVG

func OpenSVG(r io.Reader) (*SvgFile, error)

func (*SvgFile) Paths

func (svg *SvgFile) Paths() []svgPath

type SvgGroup

type SvgGroup struct {
	Name      string       `xml:"id,attr"`
	Groups    []SvgGroup   `xml:"g"`
	Paths     []svgPath    `xml:"path"`
	Polygons  []svgPolygon `xml:"polygon"`
	Transform string       `xml:"transform,attr"`
	// contains filtered or unexported fields
}

func (*SvgGroup) GetPaths

func (group *SvgGroup) GetPaths() []svgPath

type TLK

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

func NewTLK

func NewTLK() (*TLK, error)

func OpenTlk

func OpenTlk(r io.ReadSeeker) (*TLK, error)

func (*TLK) AddString

func (t *TLK) AddString(stringId int, str string, sound string)

func (*TLK) ConvertToUTF8

func (t *TLK) ConvertToUTF8(w io.WriteSeeker) error

func (*TLK) Entry

func (t *TLK) Entry(stringId int) (*tlkEntry, error)

func (*TLK) GetStringCount

func (t *TLK) GetStringCount() int

func (*TLK) SetCodepage

func (t *TLK) SetCodepage(codepage string)

func (*TLK) String

func (t *TLK) String(stringId int) (string, error)

func (*TLK) Write

func (t *TLK) Write(w io.WriteSeeker) error

func (*TLK) WriteJson

func (t *TLK) WriteJson(w io.WriteSeeker) error

type Tis

type Tis struct {
	Header tisHeader

	Name string
	// contains filtered or unexported fields
}

func NewTis

func NewTis() *Tis

func OpenTis

func OpenTis(r io.ReadSeeker, name string, root string) (*Tis, error)

func (*Tis) AddTile

func (tis *Tis) AddTile(img *image.RGBA) int

func (*Tis) SubImage

func (tis *Tis) SubImage(tileNum int) *image.RGBA

func (*Tis) Write

func (tis *Tis) Write(w io.Writer) error

type TlkJson

type TlkJson struct {
	Strings map[string]string
	Sounds  map[string]string
}

type Wed

type Wed struct {
	Header         wedHeader
	Overlays       []wedOverlay
	Header2        wedHeader2
	Doors          []wedDoor
	Tilemaps       [][]wedTilemap
	DoorTileCells  []uint16
	TileIndices    []uint16
	WallGroups     []wedWallGroup
	Polygons       []wedPolygon
	PolygonIndices []uint16
	Vertices       []wedVertex
}

func OpenWed

func OpenWed(r io.ReadSeeker) (*Wed, error)

func (*Wed) ToJson

func (wed *Wed) ToJson() (string, error)

func (*Wed) UpdateOffsets

func (wed *Wed) UpdateOffsets()

func (*Wed) Write

func (wed *Wed) Write(w io.Writer) error

func (*Wed) WritePng

func (wed *Wed) WritePng(w io.Writer) error

Jump to

Keyboard shortcuts

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