dem

package
v0.0.0-...-0713623 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package dem processes Quake DEM files.

Index

Constants

View Source
const (
	SU_VIEWHEIGHT  = 0x0001
	SU_IDEALPITCH  = 0x0002
	SU_PUNCH1      = 0x0004
	SU_PUNCH2      = 0x0008
	SU_PUNCH3      = 0x0010
	SU_VELOCITY1   = 0x0020
	SU_VELOCITY2   = 0x0040
	SU_VELOCITY3   = 0x0080
	SU_AIMENT      = 0x0100
	SU_ITEMS       = 0x0200
	SU_ONGROUND    = 0x0400
	SU_INWATER     = 0x0800
	SU_WEAPONFRAME = 0x1000
	SU_ARMOR       = 0x2000
	SU_WEAPON      = 0x4000

	U_MOREBITS   = 0x0001
	U_ORIGIN1    = 0x0002
	U_ORIGIN2    = 0x0004
	U_ORIGIN3    = 0x0008
	U_ANGLE2     = 0x0010 // read angle
	U_NOLERP     = 0x0020 // don't interpolate movement
	U_FRAME      = 0x0040 // read one more
	U_SIGNAL     = 0x0080
	U_ANGLE1     = 0x0100 // read angle
	U_ANGLE3     = 0x0200 // read angle
	U_MODEL      = 0x0400 // read byte
	U_COLORMAP   = 0x0800
	U_SKIN       = 0x1000
	U_EFFECTS    = 0x2000
	U_LONGENTITY = 0x4000

	// Effects
	EF_MUZZLEFLASH = 0x2

	TE_SPIKE        = 0
	TE_SUPERSPIKE   = 1
	TE_GUNSHOT      = 2
	TE_EXPLOSION    = 3
	TE_TAREXPLOSION = 4
	TE_LIGHTNING1   = 5
	TE_LIGHTNING2   = 6
	TE_WIZSPIKE     = 7
	TE_KNIGHTSPIKE  = 8
	TE_LIGHTNING3   = 9
	TE_LAVASPLASH   = 10
	TE_TELEPORT     = 11
	TE_EXPLOSION2   = 12
	TE_BEAM         = 13
	TE_IMPLOSION    = 14
	TE_RAILTRAIL    = 15
)

Variables

View Source
var (
	Verbose = false
)

Functions

This section is empty.

Types

type Block

type Block struct {
	Header BlockHeader
	// contains filtered or unexported fields
}

func (*Block) DecodeMessage

func (block *Block) DecodeMessage() (Message, error)

func (*Block) Messages

func (block *Block) Messages() ([]Message, error)

type BlockHeader

type BlockHeader struct {
	Blocksize uint32
	ViewAngle Vertex
}

type Demo

type Demo struct {
	Level     string
	CameraEnt uint16

	BlockCount int

	ServerInfo ServerInfo
	Entities   []Entity
	Time       float32
	// contains filtered or unexported fields
}

func Open

func Open(r io.Reader) *Demo

func (*Demo) ReadBlock

func (d *Demo) ReadBlock() (*Block, error)

type Entity

type Entity struct {
	Pos     Vertex
	Angle   Vertex
	Model   uint8
	Frame   uint8
	Skin    uint8
	Color   int
	Visible bool
}

type Message

type Message interface {
	Apply(*State)
}

type MsgCameraOrientation

type MsgCameraOrientation struct {
	X, Y, Z float32
}

func (MsgCameraOrientation) Apply

func (m MsgCameraOrientation) Apply(s *State)

type MsgCameraPos

type MsgCameraPos struct {
	Entity uint16
}

func (MsgCameraPos) Apply

func (m MsgCameraPos) Apply(s *State)

type MsgClientState

type MsgClientState struct {
	State uint8
}

func (MsgClientState) Apply

func (m MsgClientState) Apply(s *State)

type MsgDisconnect

type MsgDisconnect struct{}

func (MsgDisconnect) Apply

func (m MsgDisconnect) Apply(s *State)

type MsgFinale

type MsgFinale struct {
	Text string
}

func (*MsgFinale) Apply

func (m *MsgFinale) Apply(s *State)

type MsgFrags

type MsgFrags struct {
	Player uint8
	Frags  uint16
}

func (MsgFrags) Apply

func (m MsgFrags) Apply(s *State)

type MsgIntermission

type MsgIntermission struct {
	Text string
}

func (*MsgIntermission) Apply

func (m *MsgIntermission) Apply(s *State)

type MsgLightStyle

type MsgLightStyle struct {
	Index uint8
	Style string
}

func (MsgLightStyle) Apply

func (m MsgLightStyle) Apply(s *State)

type MsgNop

type MsgNop struct{}

func (MsgNop) Apply

func (m MsgNop) Apply(s *State)

type MsgPlaySound

type MsgPlaySound struct {
	Sound         int
	X, Y, Z       float32
	Channel       int // Auto, weapon, voice, item, body
	Entity        uint16
	EntityChannel int
	Volume        int
	Attenuation   int
}

func (MsgPlaySound) Apply

func (m MsgPlaySound) Apply(s *State)

type MsgPlayerName

type MsgPlayerName struct {
	Index uint8
	Name  string
}

func (MsgPlayerName) Apply

func (m MsgPlayerName) Apply(s *State)

type MsgPlayerState

type MsgPlayerState struct {
	Key   uint8
	Value uint32
}

func (MsgPlayerState) Apply

func (m MsgPlayerState) Apply(s *State)

type MsgSpawnBaseline

type MsgSpawnBaseline struct {
	Entity                    uint16
	X, Y, Z                   float32
	A, B, C                   float32
	Model, Frame, Color, Skin uint8
}

func (MsgSpawnBaseline) Apply

func (m MsgSpawnBaseline) Apply(s *State)

type MsgTime

type MsgTime float32

func (*MsgTime) Apply

func (m *MsgTime) Apply(s *State)

type MsgUpdate

type MsgUpdate struct {
	Entity                             uint16
	X, Y, Z                            *float32
	A, B, C                            *float32
	Model, Skin, Color, Effects, Frame *uint8
}

func (MsgUpdate) Apply

func (m MsgUpdate) Apply(s *State)

type ServerInfo

type ServerInfo struct {
	// Protocol version of the server. Quake uses the version value 15 and it is not likely, that this will change.
	ServerVersion uint32

	MaxClients uint8 // maximum number of clients in this recording. It is 1 in single player recordings or the number after the -listen command line parameter.

	GameType uint8

	Level  string
	Models []string
	Sounds []string
}

func (*ServerInfo) Apply

func (si *ServerInfo) Apply(s *State)

type SoundEvent

type SoundEvent struct {
	Time  float64
	Sound MsgPlaySound
}

type State

type State struct {
	Time       float64
	Entities   []Entity
	SeenEntity map[uint16]bool

	// 2 Means render 3D.
	ClientState int

	CameraEnt          int
	CameraViewAngle    Vertex
	CameraSetViewAngle bool // If CameraOrientation has been set, ignore header.
	ViewAngle          Vertex
	ServerInfo         ServerInfo
	Level              *bsp.BSP

	Sounds []SoundEvent
}

func NewState

func NewState() *State

func (*State) Copy

func (s *State) Copy() *State

type Vertex

type Vertex struct {
	X, Y, Z float32
}

func (*Vertex) String

func (v *Vertex) String() string

Jump to

Keyboard shortcuts

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