24 lines
508 B
Go
24 lines
508 B
Go
package main
|
|
|
|
import (
|
|
"steel/mapping"
|
|
"github.com/kettek/goro/fov"
|
|
)
|
|
|
|
func InitializeFoV(g *mapping.GameMap) fov.Map {
|
|
fovMap := fov.NewMap(g.Width, g.Height, fov.AlgorithmBBQ)
|
|
|
|
for x := range g.Tiles {
|
|
for y, tile := range g.Tiles[x] {
|
|
fovMap.SetBlocksMovement(x, y, tile.BlockMovement)
|
|
fovMap.SetBlocksLight(x, y, tile.BlockSight)
|
|
}
|
|
}
|
|
|
|
return fovMap
|
|
}
|
|
|
|
func RecomputeFov(fovMap fov.Map, centerX, centerY int, radius int, fov.Light) {
|
|
fovMap.Recompute(centerX, centerY, radius, light)
|
|
}
|