maps

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FadeOutDuration = 220 * time.Millisecond
	FadeInDuration  = 340 * time.Millisecond
	// Present the transition cover before blocking on synchronous map loading.
	FadeHandoffFrames = 1
	// Warm the base map, then allow a frame for the initial post-ack actors.
	FadePrewarmFrames = 2
)
View Source
const (
	TextureUploadCount = 32
)
View Source
const TileCursorDepthBias = rsmModelDepthBias + rsmHorizontalDepthBiasLayers*rsmHorizontalDepthBiasStep

RSM walk surfaces can be coplanar with the GAT and use layered depth biases. Keep the cursor just above the largest RSM layer while remaining far below the old 0.001 bias that let it show through furniture.

Variables

This section is empty.

Functions

func ApplyCellUpdate

func ApplyCellUpdate(ctx client.Context, update network.MapCellUpdate) bool

func AttackApproachCellFromTarget

func AttackApproachCellFromTarget(ctx client.Context, sourceX, sourceY, targetX, targetY int, attackRange int) (int, int, bool)

func AttackTargetWithinRange

func AttackTargetWithinRange(playerX, playerY, targetX, targetY, attackRange int) bool

func ClearWorldScene

func ClearWorldScene(screen *render.Frame, mapName string)

func ClickedWalkTarget

func ClickedWalkTarget(ctx client.Context, projection scene.Projection, mouseX, mouseY int) (int, int, bool)

func FindWalkPath

func FindWalkPath(gat *res.GAT, fromX, fromY, toX, toY int) ([]worldstate.WalkStep, bool)

func GNDShadowMapAlpha

func GNDShadowMapAlpha(gnd *res.GND, shadowX, shadowY int) uint8

func GNDShadowMapPoint

func GNDShadowMapPoint(x, y float64) (int, int)

func HoveredWalkCell

func HoveredWalkCell(ctx client.Context, projection scene.Projection, mouseX, mouseY int) (int, int, bool)

func InfoNotifyMessage

func InfoNotifyMessage(result uint16) string

func LoadGAT

func LoadGAT(manager *res.Manager, mapName string) (*res.GAT, string, error)

func LoadGND

func LoadGND(manager *res.Manager, mapName string) (*res.GND, string, error)

func LoadRSMModel

func LoadRSMModel(manager *res.Manager, filename string) (*res.RSM, error)

func LoadRSW

func LoadRSW(manager *res.Manager, mapName string) (*res.RSW, string, error)

func MapEffectComponent

func MapEffectComponent(component effects.Component) effects.Component

func ModelLoadTasks added in v0.24.0

func ModelLoadTasks(ctx client.Context) []func()

func NormalAttackApproachCellFromTarget

func NormalAttackApproachCellFromTarget(ctx client.Context, sourceX, sourceY, targetX, targetY int, attackRange int) (int, int, bool)

func NormalAttackTargetWithinRange

func NormalAttackTargetWithinRange(playerX, playerY, targetX, targetY, attackRange int) bool

func PathHeuristic

func PathHeuristic(from, to PathPoint) int

PathHeuristic is a lower bound for search limits and approach-cell scoring. The classic client's route priority deliberately uses Manhattan distance.

func PathStepCost

func PathStepCost(from, to PathPoint) int

func RSMAnimationFrame

func RSMAnimationFrame(rsm *res.RSM, _ res.RSWModel, now time.Time) (int, bool)

func RSMAnimationLength

func RSMAnimationLength(rsm *res.RSM) int

func RSMRenderRadius

func RSMRenderRadius() float64

func RangedAttackApproachCellFromTarget

func RangedAttackApproachCellFromTarget(ctx client.Context, sourceX, sourceY, targetX, targetY int, attackRange int) (int, int, bool)

func RangedAttackApproachCellFromTargetMatching

func RangedAttackApproachCellFromTargetMatching(ctx client.Context, sourceX, sourceY, targetX, targetY int, attackRange int, inRange scene.CellRangePredicate) (int, int, bool)

func SoundLoadTasks added in v0.24.0

func SoundLoadTasks(ctx client.Context) []func()

func WalkPath

func WalkPath(gat *res.GAT, fromX, fromY, toX, toY int) []worldstate.WalkStep

func WalkTargetReachable

func WalkTargetReachable(ctx client.Context, sourceX, sourceY, targetX, targetY int) bool

func WorldGNDHeightAt

func WorldGNDHeightAt(world *worldstate.World, x, y float64) (float64, bool)

func WorldOpaqueTriangleDrawOptions

func WorldOpaqueTriangleDrawOptions(filter render.Filter, address render.Address) *render.DrawTrianglesOptions

Types

type Fade

type Fade struct {
	Phase           FadePhase
	Started         time.Time
	CoveredFrames   int
	Change          network.MapChange
	HasChange       bool
	CharacterSelect bool
}

func (*Fade) AdvancePrewarm

func (f *Fade) AdvancePrewarm(now time.Time, uploadsPending bool)

func (*Fade) Alpha

func (f *Fade) Alpha(now time.Time) uint8

func (*Fade) Draw

func (f *Fade) Draw(screen *render.Frame, now time.Time)

func (*Fade) Elapsed

func (f *Fade) Elapsed(now time.Time) bool

func (*Fade) RecordCoveredFrame

func (f *Fade) RecordCoveredFrame()

func (*Fade) StartCharacterSelectOut

func (f *Fade) StartCharacterSelectOut(now time.Time)

func (*Fade) StartIn

func (f *Fade) StartIn(now time.Time)

func (*Fade) StartOut

func (f *Fade) StartOut(change network.MapChange, now time.Time)

func (*Fade) StartPrewarm

func (f *Fade) StartPrewarm()

type FadePhase

type FadePhase int
const (
	FadeNone FadePhase = iota
	FadeOut
	FadeHold
	FadePrewarm
	FadeIn
)

type Lighting

type Lighting struct {
	Diffuse scene.Point3

	Env scene.Point3
	// contains filtered or unexported fields
}

func (Lighting) ModelScaleNormalized

func (l Lighting) ModelScaleNormalized(normal scene.Point3) scene.Point3

type Loading added in v0.24.0

type Loading struct {
	RSWSource string
	Presented bool
	// contains filtered or unexported fields
}

Loading prepares one map on the game thread, yielding between assets so the loading screen can redraw. GPU uploads and scene warmup follow preparation.

func NewLoading added in v0.24.0

func NewLoading(ctx client.Context) *Loading

func (*Loading) Advance added in v0.24.0

func (l *Loading) Advance(ctx client.Context, scene *System) bool

Advance reports completion once. Each batch waits for a submitted frame; skipped GPU frames cannot turn loading back into a blocking loop.

func (*Loading) Draw added in v0.24.0

func (l *Loading) Draw(screen *render.Frame, percent int, alpha uint8)

func (*Loading) Percent added in v0.24.0

func (l *Loading) Percent(pendingUploads, coveredFrames int) int

func (*Loading) Prepared added in v0.24.0

func (l *Loading) Prepared() bool

func (*Loading) Release added in v0.24.0

func (l *Loading) Release()

type ModelPlacement

type ModelPlacement struct {
	Index int
	Model res.RSWModel
	BaseX float64
	BaseY float64
}

type PathPoint

type PathPoint struct {
	X int
	Y int
}

type System

type System struct {
	WhitePixel *render.Image

	Textures        map[string]*render.Image
	Images          Textures
	UpscaleTextures bool // Captured when loading the map; cached meshes keep matching UVs.
	TextureMiss     map[string]struct{}

	MapSoundNext map[int]time.Time
	Night        bool
	// contains filtered or unexported fields
}

func (*System) DrawAnimatedRSMPlacement

func (m *System) DrawAnimatedRSMPlacement(screen *render.Frame, manager *res.Manager, rsw *res.RSW, rsm *res.RSM, visible ModelPlacement, frame int)

func (*System) DrawGNDMeshes

func (m *System) DrawGNDMeshes(screen *render.Frame, manager *res.Manager, gnd *res.GND, rsw *res.RSW, projection scene.Projection)

func (*System) DrawGNDWater

func (m *System) DrawGNDWater(screen *render.Frame, manager *res.Manager, gnd *res.GND, rsw *res.RSW, projection scene.Projection, now time.Time, fog scene.SceneFog)

func (*System) DrawRSMModels

func (m *System) DrawRSMModels(screen *render.Frame, manager *res.Manager, rsw *res.RSW, models map[string]*res.RSM, gnd *res.GND, projection scene.Projection, now time.Time)

func (*System) DrawRSWEffects

func (m *System) DrawRSWEffects(screen *render.Frame, ctx client.Context, projection scene.Projection, now time.Time, fx func() *effects.System)

func (*System) DrawTileCursor

func (m *System) DrawTileCursor(screen *render.Frame, manager *res.Manager, gat *res.GAT, projection scene.Projection, x, y int)

func (*System) InvalidateLighting

func (m *System) InvalidateLighting()

func (*System) Lighting

func (m *System) Lighting(rsw *res.RSW) Lighting

func (*System) ProcessMapSounds

func (m *System) ProcessMapSounds(ctx client.Context, now time.Time, schedule func(time.Time, float64, float64, float64, ...string))

func (*System) ResetGeometry

func (m *System) ResetGeometry()

func (*System) RuntimeRSMModel

func (m *System) RuntimeRSMModel(manager *res.Manager, modelPath string) *res.RSM

func (*System) TextureLoadTasks added in v0.24.0

func (m *System) TextureLoadTasks(ctx client.Context) []func()

Use the draw-time loaders, preserving resource lookup and transparency rules. Only the current map retains these images; no cross-map texture cache grows.

type Textures

type Textures struct {
	Images      *render.ImageGroup
	Uploads     []*render.Image
	UploadBatch int
}

func (*Textures) FrameSubmitted

func (t *Textures) FrameSubmitted() bool

FrameSubmitted reports whether this submission completed an upload batch.

func (*Textures) Own

func (t *Textures) Own(img *render.Image) *render.Image

func (*Textures) PrepareUploads

func (t *Textures) PrepareUploads(screen *render.Frame) bool

Keep the map covered until all requested uploads have been submitted, then render the usual two warmup frames. A skipped GPU frame retries the same batch.

func (*Textures) Release

func (t *Textures) Release()

Jump to

Keyboard shortcuts

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