Documentation
¶
Index ¶
- Constants
- Variables
- func CompressMap(w io.Writer, fss fs.FS, dir string) error
- func IsAllowedFile(path string) bool
- func RegisterSection(sect Section)
- func SectionOrder(name string) int
- func SortRawSections(arr []RawSection)
- func SortSections(arr []Section)
- type AmbientData
- type Client
- type DestructableWall
- type DestructableWalls
- type Edge
- type FloorMap
- type FloorPos
- type GridData
- type Header
- type Info
- type Map
- type MapInfo
- type MapInfoCompat
- type MapIntro
- type MapItem
- type MapItemList
- type MapList
- type NativeDownloader
- func (d *NativeDownloader) CancelAndCleanup()
- func (d *NativeDownloader) CancelAndDelete()
- func (d *NativeDownloader) Complete() bool
- func (d *NativeDownloader) DownloadOK() bool
- func (d *NativeDownloader) Progress() float64
- func (d *NativeDownloader) Reset()
- func (d *NativeDownloader) Start(path string, sz uint) error
- func (d *NativeDownloader) WritePart(ind uint, data []byte)
- type ObjectTOC
- type Objects
- type ObjectsTOC
- type Polygon
- type PolygonPoint
- type Polygons
- type RawSection
- type Reader
- type ScanOptions
- type Script
- type ScriptData
- type ScriptHandler
- type SecretWall
- type SecretWalls
- type Section
- type Server
- type Tile
- type TilePair
- type Wall
- type WallMap
- type WallPos
- type Waypoint
- type WaypointLink
- type Waypoints
- type WindowWall
- type WindowWalls
- type Writer
- type WriterAt
- type Xfer
Constants ¶
View Source
const ( Magic = 0xFADEFACE MagicOld = 0xFADEBEEF )
View Source
const ( Dir = "maps" Ext = ".map" SoloPrefixWar = "war" SoloPrefixWiz = "wiz" SoloPrefixCon = "con" )
View Source
const (
DefaultPort = common.GameHTTPPort
)
Variables ¶
View Source
var ( ErrAPIUnsupported = errors.New("map API not supported") ErrNotFound = errors.New("map not found") )
Functions ¶
func CompressMap ¶
CompressMap collects and compresses relevant files from Nox/OpenNox map directory.
func IsAllowedFile ¶
IsAllowedFile checks if the file with a given name is allowed to be distributed with the map.
func RegisterSection ¶
func RegisterSection(sect Section)
func SectionOrder ¶
SectionOrder returns an order in which the section should be written. It returns math.MaxInt for unknown sections, so they sort last.
func SortRawSections ¶
func SortRawSections(arr []RawSection)
SortRawSections sorts a slice of sections according to SectionOrder.
func SortSections ¶
func SortSections(arr []Section)
SortSections sorts a slice of sections according to SectionOrder.
Types ¶
type AmbientData ¶
func (*AmbientData) MapSection ¶
func (*AmbientData) MapSection() string
func (*AmbientData) MarshalBinary ¶
func (sect *AmbientData) MarshalBinary() ([]byte, error)
func (*AmbientData) UnmarshalBinary ¶
func (sect *AmbientData) UnmarshalBinary(data []byte) error
type DestructableWall ¶
func (*DestructableWall) MarshalBinary ¶
func (w *DestructableWall) MarshalBinary() ([]byte, error)
type DestructableWalls ¶
type DestructableWalls struct {
Walls []DestructableWall
}
func (*DestructableWalls) MapSection ¶
func (*DestructableWalls) MapSection() string
func (*DestructableWalls) MarshalBinary ¶
func (sect *DestructableWalls) MarshalBinary() ([]byte, error)
func (*DestructableWalls) UnmarshalBinary ¶
func (sect *DestructableWalls) UnmarshalBinary(data []byte) error
type Edge ¶
func (*Edge) MarshalBinary ¶
type FloorMap ¶
func (*FloorMap) MapSection ¶
func (*FloorMap) MarshalBinary ¶
func (*FloorMap) UnmarshalBinary ¶
type GridData ¶
func (*GridData) MarshalBinary ¶
type Info ¶
func ReadMapInfo ¶
type Map ¶
type Map struct {
Info
Intro *MapIntro
Ambient *AmbientData
Walls *WallMap
Floor *FloorMap
Script *Script
ScriptData *ScriptData
SecretWalls *SecretWalls
WindowWalls *WindowWalls
DestructableWalls *DestructableWalls
Waypoints *Waypoints
Unknown []RawSection
// contains filtered or unexported fields
}
func (*Map) GridBoundingBox ¶
GridBoundingBox returns a bounding box for all walls and tiles on the map. Returned rectangle uses grid coordinates, not pixel coordinates.
type MapInfo ¶
type MapInfo struct {
Format uint16 `json:"format,omitempty"`
Summary string `json:"summary,omitempty"` // 0 [64]
Description string `json:"description,omitempty"` // 64 [512]
Version string `json:"version,omitempty"` // 576 [16]
Author string `json:"author,omitempty"` // 592 [64]
Email string `json:"email,omitempty"` // 656 [64]
Author2 string `json:"author_2,omitempty"` // 720 [128]
Email2 string `json:"email_2,omitempty"` // 848 [128]
Field7 string `json:",omitempty"` // 976 [256]
Copyright string `json:"copyright,omitempty"` // 1232 [128]
Date string `json:"date_str,omitempty"` // 1360 [32]
Flags uint32 `json:"flags,omitempty"` // 1392
MinPlayers byte `json:"min_players,omitempty"` // 1396
MaxPlayers byte `json:"max_players,omitempty"` // 1397
QuestIntro string `json:"quest_intro,omitempty"` // 1398
QuestGraphics string `json:"quest_graphics,omitempty"` // 1430
Trailing MapInfoCompat `json:"trailing,omitempty"`
}
func (*MapInfo) MapSection ¶
func (*MapInfo) MarshalBinary ¶
func (*MapInfo) UnmarshalBinary ¶
type MapInfoCompat ¶
type MapInfoCompat struct {
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
Version string `json:"version,omitempty"`
Author string `json:"author,omitempty"`
Email string `json:"email,omitempty"`
Author2 string `json:"author_2,omitempty"`
Email2 string `json:"email_2,omitempty"`
Field7 string `json:",omitempty"`
Copyright string `json:"copyright,omitempty"`
Date string `json:"date_str,omitempty"`
}
type MapIntro ¶
type MapIntro struct {
Data string
}
func (*MapIntro) MapSection ¶
func (*MapIntro) MarshalBinary ¶
func (*MapIntro) UnmarshalBinary ¶
type MapItemList ¶
type MapItemList []MapItem
func (*MapItemList) Sort ¶
func (m *MapItemList) Sort()
type NativeDownloader ¶
type NativeDownloader struct {
// contains filtered or unexported fields
}
func NewNativeDownloader ¶
func NewNativeDownloader(dir string) *NativeDownloader
func (*NativeDownloader) CancelAndCleanup ¶
func (d *NativeDownloader) CancelAndCleanup()
func (*NativeDownloader) CancelAndDelete ¶
func (d *NativeDownloader) CancelAndDelete()
func (*NativeDownloader) Complete ¶
func (d *NativeDownloader) Complete() bool
func (*NativeDownloader) DownloadOK ¶
func (d *NativeDownloader) DownloadOK() bool
func (*NativeDownloader) Progress ¶
func (d *NativeDownloader) Progress() float64
func (*NativeDownloader) Reset ¶
func (d *NativeDownloader) Reset()
func (*NativeDownloader) WritePart ¶
func (d *NativeDownloader) WritePart(ind uint, data []byte)
type ObjectTOC ¶
func (*ObjectTOC) MarshalBinary ¶
type Objects ¶
func (*Objects) MapSection ¶
func (*Objects) MarshalBinary ¶
func (*Objects) ReadObjects ¶
func (sect *Objects) ReadObjects(toc *ObjectsTOC, reg xfer.ObjectRegistry) ([]Xfer, error)
func (*Objects) UnmarshalBinary ¶
type ObjectsTOC ¶
func (*ObjectsTOC) MapSection ¶
func (*ObjectsTOC) MapSection() string
func (*ObjectsTOC) MarshalBinary ¶
func (sect *ObjectsTOC) MarshalBinary() ([]byte, error)
func (*ObjectsTOC) UnmarshalBinary ¶
func (sect *ObjectsTOC) UnmarshalBinary(data []byte) error
type Polygon ¶
type Polygon struct {
Name string
AmbientLight types.RGB
MinimapGroup byte
Points []uint32
PlayerEnter *ScriptHandler
MonsterEnter *ScriptHandler
Flags uint32
}
func (*Polygon) EncodingSize ¶
type PolygonPoint ¶
func (*PolygonPoint) EncodingSize ¶
func (w *PolygonPoint) EncodingSize() int
func (*PolygonPoint) MarshalBinary ¶
func (w *PolygonPoint) MarshalBinary() ([]byte, error)
type Polygons ¶
type Polygons struct {
Vers uint16
Points []PolygonPoint
Polygons []Polygon
}
func (*Polygons) MapSection ¶
func (*Polygons) MarshalBinary ¶
func (*Polygons) UnmarshalBinary ¶
type RawSection ¶
func (RawSection) Decode ¶
func (sect RawSection) Decode() (Section, error)
func (RawSection) Supported ¶
func (sect RawSection) Supported() bool
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) ReadScript ¶
func (*Reader) ReadSections ¶
func (*Reader) ReadSectionsRaw ¶
func (r *Reader) ReadSectionsRaw() ([]RawSection, error)
type ScanOptions ¶
type ScanOptions struct {
Solo bool // don't skip solo maps
}
type Script ¶
type Script struct {
Data []byte
}
func (*Script) MapSection ¶
func (*Script) MarshalBinary ¶
func (*Script) UnmarshalBinary ¶
type ScriptData ¶
type ScriptData struct {
Data []byte
}
func (*ScriptData) MapSection ¶
func (*ScriptData) MapSection() string
func (*ScriptData) MarshalBinary ¶
func (sect *ScriptData) MarshalBinary() ([]byte, error)
func (*ScriptData) UnmarshalBinary ¶
func (sect *ScriptData) UnmarshalBinary(data []byte) error
type ScriptHandler ¶
func (*ScriptHandler) EncodingSize ¶
func (w *ScriptHandler) EncodingSize() int
func (*ScriptHandler) MarshalBinary ¶
func (w *ScriptHandler) MarshalBinary() ([]byte, error)
func (*ScriptHandler) UnmarshalBinary ¶
func (w *ScriptHandler) UnmarshalBinary(data []byte) error
type SecretWall ¶
type SecretWall struct {
Pos image.Point
OpenWait uint32
Flags byte
State byte
OpenDelay byte
LastOpen uint32
R2 uint32
}
func (*SecretWall) MarshalBinary ¶
func (w *SecretWall) MarshalBinary() ([]byte, error)
type SecretWalls ¶
type SecretWalls struct {
Walls []SecretWall
}
func (*SecretWalls) MapSection ¶
func (*SecretWalls) MapSection() string
func (*SecretWalls) MarshalBinary ¶
func (sect *SecretWalls) MarshalBinary() ([]byte, error)
func (*SecretWalls) UnmarshalBinary ¶
func (sect *SecretWalls) UnmarshalBinary(data []byte) error
type Section ¶
type Section interface {
MapSection() string
Decode(r *binenc.Reader) error
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) RegisterOnMux ¶
type Tile ¶
func (*Tile) MarshalBinary ¶
type TilePair ¶
func (*TilePair) MarshalBinary ¶
type Wall ¶
type Wall struct {
Pos WallPos
Dir byte
DirBit byte
Material byte
Variant byte
Minimap byte
Modified byte
}
func (*Wall) MarshalBinary ¶
type WallMap ¶
func (*WallMap) MapSection ¶
func (*WallMap) MarshalBinary ¶
func (*WallMap) UnmarshalBinary ¶
type WaypointLink ¶
func (*WaypointLink) MarshalBinary ¶
func (w *WaypointLink) MarshalBinary() ([]byte, error)
type Waypoints ¶
type Waypoints struct {
Waypoints []Waypoint
}
func (*Waypoints) MapSection ¶
func (*Waypoints) MarshalBinary ¶
func (*Waypoints) UnmarshalBinary ¶
type WindowWall ¶
func (*WindowWall) MarshalBinary ¶
func (w *WindowWall) MarshalBinary() ([]byte, error)
type WindowWalls ¶
type WindowWalls struct {
Walls []WindowWall
}
func (*WindowWalls) MapSection ¶
func (*WindowWalls) MapSection() string
func (*WindowWalls) MarshalBinary ¶
func (sect *WindowWalls) MarshalBinary() ([]byte, error)
func (*WindowWalls) UnmarshalBinary ¶
func (sect *WindowWalls) UnmarshalBinary(data []byte) error
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) WriteRawSection ¶
func (w *Writer) WriteRawSection(s RawSection) error
func (*Writer) WriteRawSections ¶
func (w *Writer) WriteRawSections(arr []RawSection) error
func (*Writer) WriteSection ¶
func (*Writer) WriteSections ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.