geodata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package geodata

These are data files which store information for the game like localization strings, weapons data and globe terrain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Polygon

type Polygon struct {

	// First X coordinate/longitude
	X0 int `struct:"int16"`
	// First Y coordinate/latitude
	Y0 int `struct:"int16"`
	// Second X coordinate/longitude
	X1 int `struct:"int16"`
	// Second Y coordinate/latitude
	Y1 int `struct:"int16"`
	// Third X coordinate/longitude
	X2 int `struct:"int16"`
	// Third Y coordinate/latitude
	Y2 int `struct:"int16"`
	// Fourth* X coordinate/longitude
	X3 int `struct:"int16"`
	// Fourth* Y coordinate/latitude
	Y3 int `struct:"int16"`

	// Terrain Type/Texture	0-12
	Terrain int `struct:"int32"`
}

func (Polygon) SizeOf

func (p Polygon) SizeOf() int

func (Polygon) String

func (p Polygon) String() string

func (*Polygon) Type

func (p *Polygon) Type() PolygonType

type PolygonType

type PolygonType int
const (
	Triangle PolygonType = iota
	QuadrilateralPolygon
)

type WorldFile

type WorldFile struct {
	Polygons []Polygon
}

WorldFile describes the terrain on the geoscape screen using quadrilateral polygons and triangles loaded from GEODATA/WORLD.DAT.

The first 16 bytes of file contain the points for the polygon. 4 sets of 2 short (2-byte) integers, designating the 'X' and 'Y' coordinate (or longitude and latitude respectively, if you prefer). If the last set has an x value of -1 then it is to be rendered as a triangle, otherwise it is a quad.

The last 4 bytes in the record contain the terrain type. This could be a long integer or 2 short integers as the last 2 bytes in each record are 0.

See https://www.ufopaedia.org/index.php/WORLD.DAT for more information.

func (*WorldFile) Unpack

func (w *WorldFile) Unpack(buf []byte, order binary.ByteOrder) ([]byte, error)

Jump to

Keyboard shortcuts

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