engine

package
v0.0.0-...-0d9b2e2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NativeResX      = 320
	NativeResY      = 200
	ScaleFactor     = 5
	ScreenResX      = NativeResX * ScaleFactor
	ScreenRexY      = NativeResY * ScaleFactor
	ScreenCenterX   = ScreenResX / 2
	ScreenCenterY   = ScreenRexY / 2
	FieldOfView     = 90
	HalfFieldOfView = FieldOfView / 2
)
View Source
const (
	PlayerRotationSpeed float64 = 2
	PlayerMovementSpeed float64 = 2
)
View Source
const (
	ThingsOffset    int = 1
	LineDefsOffset  int = 2
	SideDefsOffset  int = 3
	VertexesOffset  int = 4
	SegsOffset      int = 5
	SubSectorOffset int = 6
	NodesOffset     int = 7
	SectorsOffset   int = 8
	RejectOffset    int = 9
	BlockmapOffset  int = 10
)

Index offsets between Map-marker and Map-objects

View Source
const (
	ThingsBlockSize    int32 = 10
	DirectoryBlockSize int32 = 16
	VertexesBlockSize  int32 = 4
	LinedefsBlockSize  int32 = 14
	SegsBlockSize      int32 = 12
	SubSectorBlockSize int32 = 4
	NodeBlockSize      int32 = 28
	SectorBlockSize    int32 = 24
)

Block sizes (in bytes)

Variables

View Source
var DrawBoundingBoxesInMap bool = false
View Source
var PlayerAngle float64 = 180
View Source
var PlayerOffsetX float32 = 0

only for testing

View Source
var PlayerOffsetY float32 = 0

Functions

func DegToRad

func DegToRad(angle float64) float64

func DrawMap

func DrawMap(screen *ebiten.Image, currentMap *Map)

func DrawSubSector

func DrawSubSector(screen *ebiten.Image, subSector SubSector, segs []Seg, vertexes []Vertex, depthColor uint8)

func IsPlayerLeftOfSplitter

func IsPlayerLeftOfSplitter(playerX float32, playerY float32, node Node, offsetX float32, offsetY float32) bool

func LoadWadFile

func LoadWadFile(path string)

func RadToDeg

func RadToDeg(angle float64) float64

func ReadLumpData

func ReadLumpData(directory Directory) []byte

func Traverse

func Traverse(nodeId int16, currentMap *Map, x float32, y float32, screen *ebiten.Image)

Types

type BoundingBox

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

func ConvertToBoundingBox

func ConvertToBoundingBox(data int64) BoundingBox

ConvertToBoundingBox converts data given as a 64-bit integer from the WAD file to the BoundingBox data structure.

type Directory

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

func ReadDirectoryForLumpIndex

func ReadDirectoryForLumpIndex(index int) Directory

type Linedef

type Linedef struct {
	StartVertex  int16
	EndVertex    int16
	Flags        int16
	SpecialType  int16
	SectorTag    int16
	FrontSideDef int16
	BackSideDef  int16
}

type Map

type Map struct {
	Name       string
	Things     []Thing
	Linedefs   []Linedef
	Vertexes   []Vertex
	Segs       []Seg
	SubSectors []SubSector
	Nodes      []Node
	Sectors    []Sector
}

func ReadMapData

func ReadMapData(mapName string) Map

type Node

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

Node see: https://doom.fandom.com/wiki/Node

type Sector

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

Sector see: https://doom.fandom.com/wiki/Sector

type Seg

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

Seg see: https://doom.fandom.com/wiki/Seg

type SubSector

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

SubSector see: https://doom.fandom.com/wiki/Subsector

type Thing

type Thing struct {
	XPosition int16
	YPosition int16
	Direction int16
	ThingType int16
	Flags     int16
}

Thing (see: https://doomwiki.org/wiki/Thing)

type Vec2

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

type Vertex

type Vertex struct {
	XPosition int16
	YPosition int16
}

type WadHeader

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳