bg

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: BSD-2-Clause Imports: 34 Imported by: 0

Documentation

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 {
	AreaHeader
	Actors            []AreaActor          `json:"actors"`
	Regions           []AreaRegion         `json:"regions"`
	SpawnPoints       []AreaSpawnPoint     `json:"spawn_points"`
	Entrances         []AreaEntrance       `json:"entrances"`
	Containers        []AreaContainer      `json:"containers"`
	Items             []AreaItem           `json:"items"`
	Vertices          []AreaVertex         `json:"vertices"`
	Ambients          []AreaAmbient        `json:"ambients"`
	Variables         []AreaVariable       `json:"variables"`
	ExploredBitmasks  []byte               `json:"explored_bitmasks"`
	Doors             []AreaDoor           `json:"doors"`
	Animations        []AreaAnimation      `json:"animations"`
	MapNotes          []AreaMapNote        `json:"map_notes"`
	TiledObjects      []AreaTiledObject    `json:"tiled_objects"`
	Traps             []AreaProjectileTrap `json:"traps"`
	Songs             AreaSong             `json:"songs"`
	RestInterruptions AreaRestEncounter    `json:"rest_interruptions"`
	Filename          string               `json:"-"`
}

func OpenArea

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

func (*Area) Equal added in v0.7.0

func (a *Area) Equal(other *Area) bool

func (*Area) Write added in v0.7.0

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

func (*Area) WriteJson

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

type AreaActor

type AreaActor struct {
	Name                LongString `json:"name"`
	CurrentX            uint16     `json:"current_x"`
	CurrentY            uint16     `json:"current_y"`
	DestX               uint16     `json:"dest_x"`
	DestY               uint16     `json:"dest_y"`
	Flags               uint32     `json:"flags"`
	Type                uint16     `json:"type"`
	FirstResSlot        byte       `json:"first_res_slot"`
	AlignByte           byte       `json:"align_byte"`
	AnimationType       uint32     `json:"animation_type"`
	Facing              uint16     `json:"facing"`
	AlignWord           uint16     `json:"align_word"`
	ExpirationTime      uint32     `json:"expiration_time"`
	HuntingRange        uint16     `json:"hunting_range"`
	FollowRange         uint16     `json:"follow_range"`
	TimeOfDayVisible    uint32     `json:"time_of_day_visible"`
	NumberTimesTalkedTo uint32     `json:"number_times_talked_to"`
	Dialog              Resref     `json:"dialog"`
	OverrideScript      Resref     `json:"override_script"`
	GeneralScript       Resref     `json:"general_script"`
	ClassScript         Resref     `json:"class_script"`
	RaceScript          Resref     `json:"race_script"`
	DefaultScript       Resref     `json:"default_script"`
	SpecificScript      Resref     `json:"specific_script"`
	CreatureData        Resref     `json:"creature_data"`
	CreatureOffset      uint32     `json:"creature_offset"`
	CreatureSize        uint32     `json:"creature_size"`
	Unused              [32]uint32 `json:"unused"`
}

type AreaAmbient

type AreaAmbient struct {
	Name            LongString `json:"name"`
	CoordinateX     uint16     `json:"coordinate_x"`
	CoordinateY     uint16     `json:"coordinate_y"`
	Range           uint16     `json:"range"`
	Alignment1      uint16     `json:"alignment1"`
	PitchVariance   uint32     `json:"pitch_variance"`
	VolumeVariance  uint16     `json:"volume_variance"`
	Volume          uint16     `json:"volume"`
	Sounds          [10]Resref `json:"sounds"`
	SoundCount      uint16     `json:"sound_count"`
	Alignment2      uint16     `json:"alignment2"`
	Period          uint32     `json:"period"`
	PeriodVariance  uint32     `json:"period_variance"`
	TimeOfDayActive uint32     `json:"time_of_day_active"`
	Flags           uint32     `json:"flags"`
	Unused          [16]uint32 `json:"unused"`
}

type AreaAnimation

type AreaAnimation struct {
	Name             LongString `json:"name"`
	CoordX           uint16     `json:"coord_x"`
	CoordY           uint16     `json:"coord_y"`
	TimeOfDayVisible uint32     `json:"time_of_day_visible"`
	Animation        Resref     `json:"animation"`
	BamSequence      uint16     `json:"bam_sequence"`
	BamFrame         uint16     `json:"bam_frame"`
	Flags            uint32     `json:"flags"`
	Height           int16      `json:"height"`
	Translucency     uint16     `json:"translucency"`
	StartFrameRane   uint16     `json:"start_frame_rane"`
	Probability      byte       `json:"probability"`
	Period           byte       `json:"period"`
	Palette          Resref     `json:"palette"`
	Unused           uint32     `json:"unused"`
}

type AreaContainer

type AreaContainer struct {
	Name                    LongString `json:"name"`
	CoordX                  uint16     `json:"coord_x"`
	CoordY                  uint16     `json:"coord_y"`
	Type                    uint16     `json:"type"`
	LockDifficulty          uint16     `json:"lock_difficulty"`
	Flags                   uint32     `json:"flags"`
	TrapDetectionDifficulty uint16     `json:"trap_detection_difficulty"`
	TrapRemovalDifficulty   uint16     `json:"trap_removal_difficulty"`
	ContainerTrapped        uint16     `json:"container_trapped"`
	TrapDetected            uint16     `json:"trap_detected"`
	TrapLaunchX             uint16     `json:"trap_launch_x"`
	TrapLaunchY             uint16     `json:"trap_launch_y"`
	BoundingTopLeft         uint16     `json:"bounding_top_left"`
	BoundingTopRight        uint16     `json:"bounding_top_right"`
	BoundingBottomRight     uint16     `json:"bounding_bottom_right"`
	BoundingBottomLeft      uint16     `json:"bounding_bottom_left"`
	ItemOffset              uint32     `json:"item_offset"`
	ItemCount               uint32     `json:"item_count"`
	TrapScript              Resref     `json:"trap_script"`
	VertexOffset            uint32     `json:"vertex_offset"`
	VertexCount             uint16     `json:"vertex_count"`
	TriggerRange            uint16     `json:"trigger_range"`
	OwnedBy                 LongString `json:"owned_by"`
	KeyType                 Resref     `json:"key_type"`
	BreakDifficulty         uint32     `json:"break_difficulty"`
	NotPickableString       uint32     `json:"not_pickable_string"`
	Unused                  [14]uint32 `json:"unused"`
}

type AreaDoor

type AreaDoor struct {
	Name                    LongString `json:"name"`
	DoorID                  Resref     `json:"door_id"`
	Flags                   uint32     `json:"flags"`
	OpenDoorVertexOffset    uint32     `json:"open_door_vertex_offset"`
	OpenDoorVertexCount     uint16     `json:"open_door_vertex_count"`
	ClosedDoorVertexCount   uint16     `json:"closed_door_vertex_count"`
	CloseDoorVertexOffset   uint32     `json:"close_door_vertex_offset"`
	OpenBoundingLeft        uint16     `json:"open_bounding_left"`
	OpenBoundingTop         uint16     `json:"open_bounding_top"`
	OpenBoundingRight       uint16     `json:"open_bounding_right"`
	OpenBoundingBottom      uint16     `json:"open_bounding_bottom"`
	ClosedBoundingLeft      uint16     `json:"closed_bounding_left"`
	ClosedBoundingTop       uint16     `json:"closed_bounding_top"`
	ClosedBoundingRight     uint16     `json:"closed_bounding_right"`
	ClosedBoundingBottom    uint16     `json:"closed_bounding_bottom"`
	OpenBlockVertexOffset   uint32     `json:"open_block_vertex_offset"`
	OpenBlockVertexCount    uint16     `json:"open_block_vertex_count"`
	ClosedBlockVertexCount  uint16     `json:"closed_block_vertex_count"`
	ClosedBlockVertexOffset uint32     `json:"closed_block_vertex_offset"`
	HitPoints               uint16     `json:"hit_points"`
	ArmorClass              uint16     `json:"armor_class"`
	OpenSound               Resref     `json:"open_sound"`
	ClosedSound             Resref     `json:"closed_sound"`
	CursorType              uint32     `json:"cursor_type"`
	TrapDetectionDifficulty uint16     `json:"trap_detection_difficulty"`
	TrapRemovalDifficulty   uint16     `json:"trap_removal_difficulty"`
	DoorIsTrapped           uint16     `json:"door_is_trapped"`
	TrapDetected            uint16     `json:"trap_detected"`
	TrapLaunchTargetX       uint16     `json:"trap_launch_target_x"`
	TrapLaunchTargetY       uint16     `json:"trap_launch_target_y"`
	KeyItem                 Resref     `json:"key_item"`
	DoorScript              Resref     `json:"door_script"`
	DetectionDifficulty     uint32     `json:"detection_difficulty"`
	LockDifficulty          uint32     `json:"lock_difficulty"`
	WalkToX1                uint16     `json:"walk_to_x1"`
	WalkToY1                uint16     `json:"walk_to_y1"`
	WalkToX2                uint16     `json:"walk_to_x2"`
	WalkToY2                uint16     `json:"walk_to_y2"`
	NotPickableString       uint32     `json:"not_pickable_string"`
	TriggerName             LongString `json:"trigger_name"`
	Unused                  [3]uint32  `json:"unused"`
}

type AreaEntrance

type AreaEntrance struct {
	Name        LongString `json:"name"`
	CoordX      uint16     `json:"coord_x"`
	CoordY      uint16     `json:"coord_y"`
	Orientation uint16     `json:"orientation"`
	Unused      [66]byte   `json:"unused"`
}

type AreaHeader

type AreaHeader struct {
	Signature               Signature `json:"signature"`
	Version                 Version   `json:"version"`
	AreaWed                 Resref    `json:"area_wed"`
	LastSaved               uint32    `json:"last_saved"`
	AreaFlags               uint32    `json:"area_flags"`
	AreaNorth               Resref    `json:"area_north"`
	AreaNorthFlags          uint32    `json:"area_north_flags"`
	AreaEast                Resref    `json:"area_east"`
	AreaEastFlags           uint32    `json:"area_east_flags"`
	AreaSouth               Resref    `json:"area_south"`
	AreaSouthFlags          uint32    `json:"area_south_flags"`
	AreaWest                Resref    `json:"area_west"`
	AreaWestFlags           uint32    `json:"area_west_flags"`
	Areatype                uint16    `json:"areatype"`
	Rainprobability         uint16    `json:"rainprobability"`
	SnowProability          uint16    `json:"snow_proability"`
	FogProbability          uint16    `json:"fog_probability"`
	LightningProbability    uint16    `json:"lightning_probability"`
	WindSpeed               uint16    `json:"wind_speed"`
	ActorsOffset            uint32    `json:"actors_offset"`
	ActorsCount             uint16    `json:"actors_count"`
	RegionCount             uint16    `json:"region_count"`
	RegionOffset            uint32    `json:"region_offset"`
	SpawnPointOffset        uint32    `json:"spawn_point_offset"`
	SpawnPointCount         uint32    `json:"spawn_point_count"`
	EntranceOffset          uint32    `json:"entrance_offset"`
	EntranceCount           uint32    `json:"entrance_count"`
	ContainerOffset         uint32    `json:"container_offset"`
	ContainerCount          uint16    `json:"container_count"`
	ItemCount               uint16    `json:"item_count"`
	ItemOffset              uint32    `json:"item_offset"`
	VertexOffset            uint32    `json:"vertex_offset"`
	VertexCount             uint16    `json:"vertex_count"`
	AmbientCount            uint16    `json:"ambient_count"`
	AmbientOffset           uint32    `json:"ambient_offset"`
	VariableOffset          uint32    `json:"variable_offset"`
	VariableCount           uint32    `json:"variable_count"`
	TiledObjectFlagOffset   uint16    `json:"tiled_object_flag_offset"`
	TiledObjectFlagCount    uint16    `json:"tiled_object_flag_count"`
	Script                  Resref    `json:"script"`
	ExploredSize            uint32    `json:"explored_size"`
	ExploredOffset          uint32    `json:"explored_offset"`
	DoorsCount              uint32    `json:"doors_count"`
	DoorsOffset             uint32    `json:"doors_offset"`
	AnimationCount          uint32    `json:"animation_count"`
	AnimationOffset         uint32    `json:"animation_offset"`
	TiledObjectCount        uint32    `json:"tiled_object_count"`
	TiledObjectOffset       uint32    `json:"tiled_object_offset"`
	SongEntriesOffset       uint32    `json:"song_entries_offset"`
	RestInterruptionsOffset uint32    `json:"rest_interruptions_offset"`
	AutomapOffset           uint32    `json:"automap_offset"`
	AutomapCount            uint32    `json:"automap_count"`
	ProjectileTrapsOffset   uint32    `json:"projectile_traps_offset"`
	ProjectileTrapsCount    uint32    `json:"projectile_traps_count"`
	RestMovieDay            Resref    `json:"rest_movie_day"`
	RestMovieNight          Resref    `json:"rest_movie_night"`
	Unknown                 [56]byte  `json:"unknown"`
}

type AreaItem

type AreaItem struct {
	Resource   Resref    `json:"resource"`
	Expiration uint16    `json:"expiration"`
	UsageCount [3]uint16 `json:"usage_count"`
	Flags      uint32    `json:"flags"`
}

type AreaMapNote

type AreaMapNote struct {
	CoordX uint16    `json:"coord_x"`
	CoordY uint16    `json:"coord_y"`
	Note   uint32    `json:"note"`
	Flags  uint32    `json:"flags"`
	Id     uint32    `json:"id"`
	Unused [9]uint32 `json:"unused"`
}

type AreaProjectileTrap

type AreaProjectileTrap struct {
	Projectile        Resref `json:"projectile"`
	EffectBlockOffset uint32 `json:"effect_block_offset"`
	EffectBlockSize   uint16 `json:"effect_block_size"`
	MissileId         uint16 `json:"missile_id"`
	DelayCount        uint16 `json:"delay_count"`
	RepetitionCount   uint16 `json:"repetition_count"`
	CoordX            uint16 `json:"coord_x"`
	CoordY            uint16 `json:"coord_y"`
	CoordZ            uint16 `json:"coord_z"`
	TargetType        byte   `json:"target_type"`
	PortraitNum       byte   `json:"portrait_num"`
}

type AreaRegion

type AreaRegion struct {
	Name                    LongString `json:"name"`
	Type                    uint16     `json:"type"`
	BoundingLeft            uint16     `json:"bounding_left"`
	BoundingTop             uint16     `json:"bounding_top"`
	BoundingRight           uint16     `json:"bounding_right"`
	BoundingBottom          uint16     `json:"bounding_bottom"`
	VertexCount             uint16     `json:"vertex_count"`
	VertexOffset            uint32     `json:"vertex_offset"`
	TriggerValue            uint32     `json:"trigger_value"`
	CursorType              uint32     `json:"cursor_type"`
	Destination             Resref     `json:"destination"`
	EntranceName            LongString `json:"entrance_name"`
	Flags                   uint32     `json:"flags"`
	InformationText         uint32     `json:"information_text"`
	TrapDetectionDifficulty uint16     `json:"trap_detection_difficulty"`
	TrapDisarmingDifficulty uint16     `json:"trap_disarming_difficulty"`
	TrapActivated           uint16     `json:"trap_activated"`
	TrapDetected            uint16     `json:"trap_detected"`
	TrapOriginX             uint16     `json:"trap_origin_x"`
	TrapOriginY             uint16     `json:"trap_origin_y"`
	KeyItem                 Resref     `json:"key_item"`
	RegionScript            Resref     `json:"region_script"`
	TransitionWalkToX       uint16     `json:"transition_walk_to_x"`
	TransitionWalkToY       uint16     `json:"transition_walk_to_y"`
	Unused                  [15]uint32 `json:"unused"`
}

type AreaRestEncounter

type AreaRestEncounter struct {
	Name                 LongString `json:"name"`
	RandomCreatureString [10]strref `json:"random_creature_string"`
	RandomCreature       [10]Resref `json:"random_creature"`
	RandomCreatureNum    uint16     `json:"random_creature_num"`
	Difficulty           uint16     `json:"difficulty"`
	LifeSpan             uint32     `json:"life_span"`
	HuntingRange         uint16     `json:"hunting_range"`
	FollowRange          uint16     `json:"follow_range"`
	MaxTypeNum           uint16     `json:"max_type_num"`
	Activated            uint16     `json:"activated"`
	ProbabilityDay       uint16     `json:"probability_day"`
	ProbabilityNight     uint16     `json:"probability_night"`
	Unused               [56]uint8  `json:"unused"`
}

type AreaSong

type AreaSong struct {
	DaySong              uint32     `json:"day_song"`
	NightSong            uint32     `json:"night_song"`
	WinSong              uint32     `json:"win_song"`
	BattleSong           uint32     `json:"battle_song"`
	LoseSong             uint32     `json:"lose_song"`
	AltMusic0            uint32     `json:"alt_music0"`
	AltMusic1            uint32     `json:"alt_music1"`
	AltMusic2            uint32     `json:"alt_music2"`
	AltMusic3            uint32     `json:"alt_music3"`
	AltMusic4            uint32     `json:"alt_music4"`
	DayAmbient           Resref     `json:"day_ambient"`
	DayAmbientExtended   Resref     `json:"day_ambient_extended"`
	DayAmbientVolume     uint32     `json:"day_ambient_volume"`
	NightAmbient         Resref     `json:"night_ambient"`
	NightAmbientExtended Resref     `json:"night_ambient_extended"`
	NightAmbientVolume   uint32     `json:"night_ambient_volume"`
	Unused               [16]uint32 `json:"unused"`
}

type AreaSpawnPoint

type AreaSpawnPoint struct {
	Name                LongString `json:"name"`
	CoordX              uint16     `json:"coord_x"`
	CoordY              uint16     `json:"coord_y"`
	RandomCreatures     [10]Resref `json:"random_creatures"`
	RandomCreatureCount uint16     `json:"random_creature_count"`
	Difficulty          uint16     `json:"difficulty"`
	SpawnRate           uint16     `json:"spawn_rate"`
	Flags               uint16     `json:"flags"`
	LifeSpan            uint32     `json:"life_span"`
	HuntingRange        uint32     `json:"hunting_range"`
	FollowRange         uint32     `json:"follow_range"`
	MaxTypeNum          uint32     `json:"max_type_num"`
	Activated           uint16     `json:"activated"`
	TimeOfDay           uint32     `json:"time_of_day"`
	ProbabilityDay      uint16     `json:"probability_day"`
	ProbabilityNight    uint16     `json:"probability_night"`
	Unused              [14]uint32 `json:"unused"`
}

type AreaTiledObject

type AreaTiledObject struct {
	Name                       LongString `json:"name"`
	TileID                     Resref     `json:"tile_id"`
	Flags                      uint32     `json:"flags"`
	PrimarySearchSquareStart   uint32     `json:"primary_search_square_start"`
	PrimarySearchSquareCount   uint16     `json:"primary_search_square_count"`
	SecondarySearchSquareCount uint16     `json:"secondary_search_square_count"`
	SecondarySearcHSquareStart uint32     `json:"secondary_searc_h_square_start"`
	Unused                     [12]uint32 `json:"unused"`
}

type AreaVariable

type AreaVariable struct {
	Name       LongString `json:"name"`
	Type       uint16     `json:"type"`
	ResRefType uint16     `json:"res_ref_type"`
	DWValue    uint32     `json:"dw_value"`
	IntValue   int32      `json:"int_value"`
	FloatValue float64    `json:"float_value"`
	ScriptName LongString `json:"script_name"`
}

type AreaVertex

type AreaVertex struct {
	Coordinate uint16 `json:"coordinate"`
}

type BG added in v0.6.3

type BG interface {
	Write(w io.Writer) error
	WriteJson(w io.Writer) error
}

type BIF

type BIF struct {
	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        Signature
	Version          Version
	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       Signature
	Version         Version
	Frames          uint16
	Cycles          uint8
	CompressedColor uint8
	FrameOffset     uint32
	PaletteOffset   uint32
	FrameLutOffset  uint32
}

type BamHeaderV2

type BamHeaderV2 struct {
	Signature                                  Signature
	Version                                    Version
	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 {
	CreHeader
	KnownSpells          []CreKnownSpell          `json:"known_spells"`
	MemorizedSpellLevels []CreMemorizedSpellLevel `json:"memorized_spell_levels"`
	MemorizedSpells      []CreMemorizedSpell      `json:"memorized_spells"`
	Effects              []ItmEffect              `json:"effects"`
	Effectsv2            []EffEffect              `json:"effectsv2"`
	Items                []CreItem                `json:"item_table"`
	ItemSlots            CreEquipment             `json:"item_slots"`
	Filename             string                   `json:"-"`
}

func OpenCre

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

func (*CRE) Equal added in v0.7.0

func (cre *CRE) Equal(other *CRE) bool

func (*CRE) Write

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

func (*CRE) WriteJson

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

type Component added in v0.6.2

type Component struct {
	TpFile        string `json:"tp_file"`
	Name          string `json:"name"`
	Lang          string `json:"lang"`
	Component     string `json:"component"`
	ComponentName string `json:"component_name"`
	SubComponent  string `json:"sub_component"`
	Version       string `json:"version"`
}

type CreEquipment added in v0.7.0

type CreEquipment struct {
	Helmet                uint16 `json:"helmet"`
	Armor                 uint16 `json:"armor"`
	Shield                uint16 `json:"shield"`
	Gloves                uint16 `json:"gloves"`
	LeftRing              uint16 `json:"left_ring"`
	RightRing             uint16 `json:"right_ring"`
	Amulet                uint16 `json:"amulet"`
	Belt                  uint16 `json:"belt"`
	Boots                 uint16 `json:"boots"`
	Weapon1               uint16 `json:"weapon_1"`
	Weapon2               uint16 `json:"weapon_2"`
	Weapon3               uint16 `json:"weapon_3"`
	Weapon4               uint16 `json:"weapon_4"`
	Quiver1               uint16 `json:"quiver_1"`
	Quiver2               uint16 `json:"quiver_2"`
	Quiver3               uint16 `json:"quiver_3"`
	Quiver4               uint16 `json:"quiver_4"`
	Cloak                 uint16 `json:"cloak"`
	QuickItem1            uint16 `json:"quick_item_1"`
	QuickItem2            uint16 `json:"quick_item_2"`
	QuickItem3            uint16 `json:"quick_item_3"`
	InventoryItem1        uint16 `json:"inventory_item_1"`
	InventoryItem2        uint16 `json:"inventory_item_2"`
	InventoryItem3        uint16 `json:"inventory_item_3"`
	InventoryItem4        uint16 `json:"inventory_item_4"`
	InventoryItem5        uint16 `json:"inventory_item_5"`
	InventoryItem6        uint16 `json:"inventory_item_6"`
	InventoryItem7        uint16 `json:"inventory_item_7"`
	InventoryItem8        uint16 `json:"inventory_item_8"`
	InventoryItem9        uint16 `json:"inventory_item_9"`
	InventoryItem10       uint16 `json:"inventory_item_10"`
	InventoryItem11       uint16 `json:"inventory_item_11"`
	InventoryItem12       uint16 `json:"inventory_item_12"`
	InventoryItem13       uint16 `json:"inventory_item_13"`
	InventoryItem14       uint16 `json:"inventory_item_14"`
	InventoryItem15       uint16 `json:"inventory_item_15"`
	InventoryItem16       uint16 `json:"inventory_item_16"`
	MagicWeapon           uint16 `json:"magic_weapon"`
	SelectedWeapon        uint16 `json:"selected_weapon"`
	SelectedWeaponAbility uint16 `json:"selected_weapon_ability"`
}

type CreHeader added in v0.7.0

type CreHeader struct {
	Signature                    Signature   `json:"signature"`
	Version                      Version     `json:"version"`
	LongName                     strref      `json:"long_name"`
	ShortName                    strref      `json:"short_name"`
	Flags                        uint32      `json:"flags"`
	XPValue                      uint32      `json:"xp_value"`
	XP                           uint32      `json:"xp"`
	Gold                         uint32      `json:"gold"`
	PermanentStatusFlags         uint32      `json:"permanent_status_flags"`
	HitPoints                    uint16      `json:"hit_points"`
	MaxHitPointsBase             uint16      `json:"max_hit_points_base"`
	AnimationType                uint32      `json:"animation_type"`
	MetalColor                   uint8       `json:"metal_color"`
	MinorColor                   uint8       `json:"minor_color"`
	MajorColor                   uint8       `json:"major_color"`
	SkinColor                    uint8       `json:"skin_color"`
	LeatherColor                 uint8       `json:"leather_color"`
	ArmorColor                   uint8       `json:"armor_color"`
	HairColor                    uint8       `json:"hair_color"`
	EffStructureVersion          uint8       `json:"eff_structure_version"`
	SmallPortrait                Resref      `json:"small_portrait"`
	LargePortrait                Resref      `json:"large_portrait"`
	Reputation                   int8        `json:"reputation"`
	HideInShadowsBase            uint8       `json:"hide_in_shadows_base"`
	ArmorClass                   int16       `json:"armor_class"`
	ArmorClassBase               int16       `json:"armor_class_base"`
	ArmorClassCurshingAdjustment int16       `json:"armor_class_curshing_adjustment"`
	ArmorClassMissileAdjustment  int16       `json:"armor_class_missile_adjustment"`
	ArmorClassPiercingAdjustment int16       `json:"armor_class_piercing_adjustment"`
	ArmorClassSlashingAdjustment int16       `json:"armor_class_slashing_adjustment"`
	Thac0                        int8        `json:"thac0"`
	NumberOfAttacksBase          uint8       `json:"number_of_attacks_base"`
	SaveVsDeathBase              uint8       `json:"save_vs_death_base"`
	SaveVsWandsBase              uint8       `json:"save_vs_wands_base"`
	SaveVsPolyBase               uint8       `json:"save_vs_poly_base"`
	SaveVsBreathBase             uint8       `json:"save_vs_breath_base"`
	SaveVsSpellBase              uint8       `json:"save_vs_spell_base"`
	ResistFireBase               int8        `json:"resist_fire_base"`
	ResistColdBase               int8        `json:"resist_cold_base"`
	ResistElectricityBase        int8        `json:"resist_electricity_base"`
	ResistAcidBase               int8        `json:"resist_acid_base"`
	ResistMagicBase              int8        `json:"resist_magic_base"`
	ResistMagicFireBase          int8        `json:"resist_magic_fire_base"`
	ResistMagicColdBase          int8        `json:"resist_magic_cold_base"`
	ResistSlashingBase           int8        `json:"resist_slashing_base"`
	ResistCrushingBase           int8        `json:"resist_crushing_base"`
	ResistPiercingBase           int8        `json:"resist_piercing_base"`
	ResistMissileBase            int8        `json:"resist_missile_base"`
	DetectIllusionBase           uint8       `json:"detect_illusion_base"`
	SetTrapsBase                 uint8       `json:"set_traps_base"`
	LoreBase                     uint8       `json:"lore_base"`
	LockPickingBase              uint8       `json:"lock_picking_base"`
	MoveSilentlyBase             uint8       `json:"move_silently_base"`
	FindTrapsBase                uint8       `json:"find_traps_base"`
	PickPocketBase               uint8       `json:"pick_pocket_base"`
	Fatigue                      uint8       `json:"fatigue"`
	Intoxication                 uint8       `json:"intoxication"`
	LuckBase                     int8        `json:"luck_base"`
	ProficiencyLargeSwords       uint8       `json:"proficiency_large_swords"`
	ProficiencySmallSwords       uint8       `json:"proficiency_small_swords"`
	ProficiencyBows              uint8       `json:"proficiency_bows"`
	ProficiencySpears            uint8       `json:"proficiency_spears"`
	ProficiencyBlunt             uint8       `json:"proficiency_blunt"`
	ProficiencySpiked            uint8       `json:"proficiency_spiked"`
	ProficiencyAxes              uint8       `json:"proficiency_axes"`
	ProficiencyMissiles          uint8       `json:"proficiency_missiles"`
	UnusedProficiencies          [7]uint8    `json:"unused_proficiencies"`
	NightmareMode                uint8       `json:"nightmare_mode"`
	Translucency                 uint8       `json:"translucency"`
	ReputationLossIfKilled       uint8       `json:"reputation_loss_if_killed"`
	ReputationLossIfJoinsParty   uint8       `json:"reputation_loss_if_joins_party"`
	ReputationLossIfLeavesParty  uint8       `json:"reputation_loss_if_leaves_party"`
	UndeadLevel                  uint8       `json:"undead_level"`
	TrackingBase                 uint8       `json:"tracking_base"`
	TrackingTarget               LongString  `json:"tracking_target"`
	Strrefs                      [100]strref `json:"strrefs"`
	LevelFirstClass              uint8       `json:"level_first_class"`
	LevelSecondClass             uint8       `json:"level_second_class"`
	LevelThirdClass              uint8       `json:"level_third_class"`
	Sex                          uint8       `json:"sex"`
	Strength                     uint8       `json:"strength"`
	StrengthBonus                uint8       `json:"strength_bonus"`
	Intelligence                 uint8       `json:"intelligence"`
	Wisdom                       uint8       `json:"wisdom"`
	Dexterity                    uint8       `json:"dexterity"`
	Constitution                 uint8       `json:"constitution"`
	Charisma                     uint8       `json:"charisma"`
	Morale                       uint8       `json:"morale"`
	MoraleBreak                  uint8       `json:"morale_break"`
	RacialEnemy                  uint8       `json:"racial_enemy"`
	MoraleRecoveryTime           uint16      `json:"morale_recovery_time"`
	Kit                          uint32      `json:"kit"`
	OverrideScript               Resref      `json:"override_script"`
	ClassScript                  Resref      `json:"class_script"`
	RaceScript                   Resref      `json:"race_script"`
	GeneralScript                Resref      `json:"general_script"`
	DefaultScript                Resref      `json:"default_script"`
	EnemyAlly                    uint8       `json:"enemy_ally"`
	General                      uint8       `json:"general"`
	Race                         uint8       `json:"race"`
	Class                        uint8       `json:"class"`
	Specific                     uint8       `json:"specific"`
	Gender                       uint8       `json:"gender"`
	ObjectReferences             [5]uint8    `json:"object_references"`
	Alignment                    uint8       `json:"alignment"`
	GlobalActorEnumeration       uint16      `json:"global_actor_enumeration"`
	LocalActorEnumeration        uint16      `json:"local_actor_enumeration"`
	DeathVariable                LongString  `json:"death_variable"`
	KnownSpellListOffset         uint32      `json:"known_spell_list_offset"`
	KnownSpellListCount          uint32      `json:"known_spell_list_count"`
	MemorizationLevelListOffset  uint32      `json:"memorization_level_list_offset"`
	MemorizationLevelListCount   uint32      `json:"memorization_level_list_count"`
	MemorizationSpellListOffset  uint32      `json:"memorization_spell_list_offset"`
	MemorizationSpellListCount   uint32      `json:"memorization_spell_list_count"`
	EquipmentListOffset          uint32      `json:"equipment_list_offset"`
	ItemListOffset               uint32      `json:"item_list_offset"`
	ItemListCount                uint32      `json:"item_list_count"`
	EffectListOffset             uint32      `json:"effect_list_offset"`
	EffectListCount              uint32      `json:"effect_list_count"`
	Dialog                       Resref      `json:"dialog"`
}

type CreItem added in v0.7.0

type CreItem struct {
	CreItemHeader
	Flags uint32 `json:"flags"`
}

func (*CreItem) MarshalJSON added in v0.7.0

func (d *CreItem) MarshalJSON() ([]byte, error)

func (*CreItem) UnmarshalJSON added in v0.7.0

func (d *CreItem) UnmarshalJSON(b []byte) error

type CreItemHeader added in v0.7.0

type CreItemHeader struct {
	ItemName               Resref `json:"item_name"`
	ItemExpirationTimeHour uint8  `json:"item_expiration_time_hour"`
	ItemExpirationTime     uint8  `json:"item_expiration_time"`
	Quantity1              uint16 `json:"quantity_1"`
	Quantity2              uint16 `json:"quantity_2"`
	Quantity3              uint16 `json:"quantity_3"`
}

type CreKnownSpell added in v0.7.0

type CreKnownSpell struct {
	SpellName  Resref `json:"spell_name"`
	SpellLevel uint16 `json:"spell_level"`
	SpellType  uint16 `json:"spell_type"`
}

type CreMemorizedSpell added in v0.7.0

type CreMemorizedSpell struct {
	SpellName Resref `json:"spell_name"`
	Memorised uint32 `json:"memorised"`
}

type CreMemorizedSpellLevel added in v0.7.0

type CreMemorizedSpellLevel struct {
	SpellLevel             uint16 `json:"spell_level"`
	BaseCount              uint16 `json:"base_count"`
	Count                  uint16 `json:"count"`
	MagicType              uint16 `json:"magic_type"`
	MemorizedStartingSpell uint32 `json:"memorized_starting_spell"`
	MemorizedCount         uint32 `json:"memorized_count"`
}

type DLG

type DLG struct {
	States             []DlgState
	Transitions        []DlgTransition
	StateTriggers      []string
	TransitionTriggers []string
	Actions            []string
	// contains filtered or unexported fields
}

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       strref
	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 DynamicFlagsJson added in v0.7.0

type DynamicFlagsJson struct {
	Identified  uint8 `json:"identified"`
	Unstealable uint8 `json:"unstealable"`
	Stolen      uint8 `json:"stolen"`
	Undroppable uint8 `json:"undroppable"`
}

type EffEffect

type EffEffect struct {
	Signature        Signature
	Version          Version
	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) Write added in v0.7.0

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

func (*EffEffect) WriteJson

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

type EffHeader added in v0.7.0

type EffHeader struct {
	Signature Signature
	Version   Version
}

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)

func OpenINI

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

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 {
	ItmHeader
	Abilities []itmAbility `json:"abilities"`
	Effects   []ItmEffect  `json:"effects"`
	Filename  string       `json:"-"`
}

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 `json:"effect_id"`
	TargetType       uint8  `json:"target_type"`
	SpellLevel       uint8  `json:"spell_level"`
	EffectAmount     int32  `json:"effect_amount"`
	Flags            uint32 `json:"flags"`
	DurationType     uint16 `json:"duration_type"`
	Duration         uint32 `json:"duration"`
	ProbabilityUpper uint8  `json:"probability_upper"`
	ProbabilityLower uint8  `json:"probability_lower"`
	Res              Resref `json:"res"`
	NumDice          uint32 `json:"num_dice"`
	DiceSize         uint32 `json:"dice_size"`
	SavingThrow      uint32 `json:"saving_throw"`
	SaveMod          int32  `json:"save_mod"`
	Special          uint32 `json:"special"`
}

func (*ItmEffect) Write added in v0.7.0

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

func (*ItmEffect) WriteJson

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

type ItmHeader added in v0.7.0

type ItmHeader struct {
	Signature              Signature `json:"signature"`
	Version                Version   `json:"version"`
	GenericName            uint32    `json:"generic_name"`
	IdentifiedName         uint32    `json:"identified_name"`
	UsedUpItemID           Resref    `json:"used_up_item_id"`
	ItemFlags              uint32    `json:"item_flags"`
	ItemType               uint16    `json:"item_type"`
	NotUsableBy            uint32    `json:"not_usable_by"`
	AnimationType          uint16    `json:"animation_type"`
	MinLevelRequired       uint16    `json:"min_level_required"`
	MinStrRequired         uint16    `json:"min_str_required"`
	MinStrBonusRequired    uint8     `json:"min_str_bonus_required"`
	NotUsableBy2a          uint8     `json:"not_usable_by2a"`
	MinIntRequired         uint8     `json:"min_int_required"`
	NotUsableBy2b          uint8     `json:"not_usable_by2b"`
	MinDexRequired         uint8     `json:"min_dex_required"`
	NotUsableBy2c          uint8     `json:"not_usable_by2c"`
	MinWisRequired         uint8     `json:"min_wis_required"`
	NotUsableBy2d          uint8     `json:"not_usable_by2d"`
	MinConRequired         uint8     `json:"min_con_required"`
	ProficiencyType        uint8     `json:"proficiency_type"`
	MinChrRequired         uint16    `json:"min_chr_required"`
	BaseValue              uint32    `json:"base_value"`
	MaxStackable           uint16    `json:"max_stackable"`
	ItemIcon               Resref    `json:"item_icon"`
	LoreValue              uint16    `json:"lore_value"`
	GroundIcon             Resref    `json:"ground_icon"`
	BaseWeight             uint32    `json:"base_weight"`
	GenericDescription     uint32    `json:"generic_description"`
	IdentifiedDescription  uint32    `json:"identified_description"`
	DescriptionPicture     Resref    `json:"description_picture"`
	Attributes             uint32    `json:"attributes"`
	AbilityOffset          uint32    `json:"ability_offset"`
	AbilityCount           uint16    `json:"ability_count"`
	EffectsOffset          uint32    `json:"effects_offset"`
	EquippedStartingEffect uint16    `json:"equipped_starting_effect"`
	EquippedEffectCount    uint16    `json:"equiped_effect_count"`
}

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() error

type Log added in v0.6.2

type Log struct {
	Comments   []string    `json:"comments"`
	Components []Component `json:"components"`
}

func OpenLog added in v0.6.2

func OpenLog(r io.ReadSeeker) (*Log, error)

func (*Log) Equal added in v0.6.2

func (l *Log) Equal(other *Log) bool

func (*Log) Write added in v0.6.2

func (l *Log) Write(w io.Writer) error

func (*Log) WriteJson added in v0.6.2

func (l *Log) WriteJson(w io.Writer) error

type LongString

type LongString [32]byte

func (*LongString) MarshalJSON

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

func (*LongString) String

func (l *LongString) String() string

func (*LongString) UnmarshalJSON added in v0.7.0

func (l *LongString) UnmarshalJSON(b []byte) error

func (*LongString) Valid added in v0.7.0

func (l *LongString) Valid() bool

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 [8]byte

func (*Resref) MarshalJSON

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

func (Resref) String

func (r Resref) String() string

func (*Resref) UnmarshalJSON added in v0.6.2

func (r *Resref) UnmarshalJSON(b []byte) error

func (*Resref) Valid

func (r *Resref) Valid() bool

type SPL

type SPL struct {
	SplHeader
	Abilities []SplAbility `json:"abilities"`
	Effects   []ItmEffect  `json:"effects"`
	Filename  string       `json:"-"`
}

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 STO

type STO struct {
	StoHeader
	Items              []StoItems     `json:"items_for_sale"`
	Drinks             []StoDrinks    `json:"drinks_for_sale"`
	Cures              []StoCures     `json:"cures_for_sale"`
	ItemsPurchasedHere []StoItemTypes `json:"items_purchased_here"`
	Filename           string         `json:"-"`
}

func OpenSTO

func OpenSTO(r io.ReadSeeker) (*STO, error)

func (*STO) Equal added in v0.6.2

func (sto *STO) Equal(other *STO) bool

func (*STO) Write

func (sto *STO) Write(w io.Writer) error

func (*STO) WriteJson

func (sto *STO) WriteJson(w io.Writer) error

type Section

type Section map[string]string

A Section represents a single section of an INI file.

type Signature added in v0.6.2

type Signature [4]byte

func (*Signature) MarshalJSON added in v0.6.2

func (s *Signature) MarshalJSON() ([]byte, error)

func (Signature) String added in v0.6.2

func (s Signature) String() string

func (*Signature) UnmarshalJSON added in v0.6.2

func (s *Signature) UnmarshalJSON(b []byte) error

func (*Signature) Valid added in v0.6.2

func (s *Signature) Valid() bool

type SplAbility added in v0.7.0

type SplAbility struct {
	Type            uint16 `json:"type"`
	QuickSlotType   uint16 `json:"quick_slot_type"`
	QuickSlotIcon   Resref `json:"quick_slot_icon"`
	ActionType      uint8  `json:"action_type"`
	ActionCount     uint8  `json:"action_count"`
	Range           uint16 `json:"range"`
	MinCasterLevel  uint16 `json:"min_caster_level"`
	SpeedFactor     uint16 `json:"speed_factor"`
	TimesPerDay     uint16 `json:"times_per_day"`
	DamageDice      uint16 `json:"damage_dice"`
	DamageDiceCount uint16 `json:"damage_dice_count"`
	DamageDiceBonus uint16 `json:"damage_dice_bonus"`
	DamageType      uint16 `json:"damage_type"`
	EffectCount     uint16 `json:"effect_count"`
	StartingEffect  uint16 `json:"starting_effect"`
	MaxUsageCount   uint16 `json:"max_usage_count"`
	UsageFlags      uint16 `json:"usage_flags"`
	MissileType     uint16 `json:"missile_type"`
}

type SplHeader added in v0.7.0

type SplHeader struct {
	Signature             Signature `json:"signature"`
	Version               Version   `json:"version"`
	GenericName           uint32    `json:"generic_name"`
	IdentifiedName        uint32    `json:"identified_name"`
	UsedUpItemID          Resref    `json:"used_up_item_id"`
	ItemFlags             uint32    `json:"item_flags"`
	ItemType              uint16    `json:"item_type"`
	NotUsableBy           uint32    `json:"not_usable_by"`
	AnimationType         [2]uint8  `json:"animation_type"`
	MinLevelRequired      uint8     `json:"min_level_required"`
	School                uint8     `json:"school"`
	MinStrRequired        uint8     `json:"min_str_required"`
	SecondaryType         uint8     `json:"secondary_type"`
	MinStrBonusRequired   uint8     `json:"min_str_bonus_required"`
	NotUsableBy2a         uint8     `json:"not_usable_by2a"`
	MinIntRequired        uint8     `json:"min_int_required"`
	NotUsableBy2b         uint8     `json:"not_usable_by2b"`
	MinDexRequired        uint8     `json:"min_dex_required"`
	NotUsableBy2c         uint8     `json:"not_usable_by2c"`
	MinWisRequired        uint8     `json:"min_wis_required"`
	NotUsableBy2d         uint8     `json:"not_usable_by2d"`
	MinConRequired        uint16    `json:"min_con_required"`
	MinChrRequired        uint16    `json:"min_chr_required"`
	SpellLevel            uint32    `json:"spell_level"`
	MaxStackable          uint16    `json:"max_stackable"`
	ItemIcon              Resref    `json:"item_icon"`
	LoreValue             uint16    `json:"lore_value"`
	GroundIcon            Resref    `json:"ground_icon"`
	BaseWeight            uint32    `json:"base_weight"`
	GenericDescription    uint32    `json:"generic_description"`
	IdentifiedDescription uint32    `json:"identified_description"`
	DescriptionPicture    Resref    `json:"description_picture"`
	Attributes            uint32    `json:"attributes"`
	AbilityOffset         uint32    `json:"ability_offset"`
	AbilityCount          uint16    `json:"ability_count"`
	EffectsOffset         uint32    `json:"effects_offset"`
	CastingStartingEffect uint16    `json:"casting_starting_effect"`
	CastingEffectCount    uint16    `json:"casting_effect_count"`
}

type StoCures added in v0.7.0

type StoCures struct {
	FileNameOfSpell Resref `json:"file_name_of_spell"`
	SpellPrice      uint32 `json:"spell_price"`
}

type StoDrinks added in v0.7.0

type StoDrinks struct {
	RumourResource    Resref `json:"rumour_resource"`
	Name              uint32 `json:"name"`
	Price             uint32 `json:"price"`
	AlcoholicStrength uint32 `json:"alcoholic_strength"`
}

type StoHeader added in v0.7.0

type StoHeader struct {
	Signature                    Signature `json:"signature"`
	Version                      Version   `json:"version"`
	StoreType                    uint32    `json:"store_type"`
	Name                         uint32    `json:"name"`
	StoreFlags                   [4]uint8  `json:"store_flags"`
	SellPriceMarkup              uint32    `json:"sell_price_markup"`
	BuyPriceMarkup               uint32    `json:"buy_price_markup"`
	DepreciationRate             uint32    `json:"depreciation_rate"`
	PercentageChanceStealFailure uint16    `json:"percentage_chance_steal_failure"`
	Capacity                     uint16    `json:"capacity"`
	Unknown                      [8]uint8  `json:"unknown"`
	OffsetToItemsPurchased       uint32    `json:"offset_to_items_purchased"`
	CountOfItemsPurchased        uint32    `json:"count_of_items_purchased"`
	OffsetToItemsForSale         uint32    `json:"offset_to_items_for_sale"`
	CountOfItemsForSale          uint32    `json:"count_of_items_for_sale"`
	Lore                         uint32    `json:"lore"`
	IdPrice                      uint32    `json:"id_price"`
	RumoursTavern                Resref    `json:"rumours_tavern"`
	OffsetToDrinks               uint32    `json:"offset_to_drinks"`
	CountOfDrinks                uint32    `json:"count_of_drinks"`
	RumoursTemple                Resref    `json:"rumours_temple"`
	RoomFlags                    [4]uint8  `json:"room_flags"`
	PriceOfAPeasantRoom          uint32    `json:"price_of_a_peasant_room"`
	PriceOfAMerchantRoom         uint32    `json:"price_of_a_merchant_room"`
	PriceOfANobleRoom            uint32    `json:"price_of_a_noble_room"`
	PriceOfARoyalRoom            uint32    `json:"price_of_a_royal_room"`
	OffsetToCures                uint32    `json:"offset_to_cures"`
	CountOfCures                 uint32    `json:"count_of_cures"`
	Unused                       [36]uint8 `json:"unused"`
}

type StoItemTypes added in v0.7.0

type StoItemTypes uint32
const (
	BooksMisc StoItemTypes = iota
	AmuletsAndNecklaces
	Armor
	BeltsAndGirdles
	Boots
	Arrows
	BracersAndGauntlets
	Headgear
	Keys
	Potions
	Rings
	Scrolls
	Shields
	Food
	Bullets
	Bows
	Daggers
	Maces
	Slings
	SmallSwords
	LargeSwords
	Hammers
	MorningStars
	Flails
	Darts
	Axes
	Quarterstaff
	Crossbow
	HandToHandWeapons
	Spears
	Halberds
	CrossbowBolts
	CloaksAndRobes
	GoldPieces
	Gems
	Wands
	ContainersBrokenArmor
	BooksBrokenShieldsBracelets
	FamiliarsBrokenSwordsEarrings
	TattoosPST
	LensesPST
	BucklersTeeth
	Candles
	Unknown1
	Clubs
	Unknown2
	Unknown3
	LargeShieldsIWD
	Unknown4
	MediumShieldsIWD
	Notes
	Unknown5
	Unknown6
	SmallShields
	Unknown7
	TelescopesIWD
	DrinksIWD
	GreatSwordsIWD
	Container
	FurPelt
	LeatherArmor
	StuddedLeatherArmor
	ChainMail
	SplintMail
	HalfPlate
	FullPlate
	HideArmor
	Robe
	Unknown8
	BastardSword
	Scarf
	FoodIWD2
	Hat
	Gauntlet
)

func (StoItemTypes) String added in v0.7.0

func (it StoItemTypes) String() string

type StoItems added in v0.7.0

type StoItems struct {
	FileNameOfItem     Resref `json:"filename_of_item"`
	ItemExpirationTime uint16 `json:"item_expiration_time"`
	Charges1           uint16 `json:"charges1"`
	Charges2           uint16 `json:"charges2"`
	Charges3           uint16 `json:"charges3"`
	Flags              uint32 `json:"flags"`
	Amount             uint32 `json:"amount"`
	InfiniteSupplyFlag uint32 `json:"infinite_supply_flag"`
}

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 Version added in v0.6.2

type Version [4]byte

func (*Version) MarshalJSON added in v0.6.2

func (v *Version) MarshalJSON() ([]byte, error)

func (Version) String added in v0.6.2

func (v Version) String() string

func (*Version) UnmarshalJSON added in v0.6.2

func (v *Version) UnmarshalJSON(b []byte) error

func (*Version) Valid added in v0.6.2

func (v *Version) Valid() bool

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