fix supid viewport bug

This commit is contained in:
2019-11-01 19:59:12 +03:00
parent 529f5a5749
commit 17ef52a5cf
5 changed files with 29 additions and 14 deletions

View File

@ -195,7 +195,9 @@ func (ps *precomputedShade) PrecomputeFovMap() {
}
func (ps *precomputedShade) recalc(level *gamemap.Level, initCoords types.Coords, radius int) {
for i, _ := range ps.CellList {
ps.CellList[i].lit = 0
}
ps.originCoords = initCoords
if radius > ps.MaxTorchRadius {
@ -250,6 +252,7 @@ func (ps *precomputedShade) recalc(level *gamemap.Level, initCoords types.Coords
func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Coords, radius int) {
level.SetAllInvisible()
ps.recalc(level, initCoords, radius)
for _, cell := range ps.CellList {
@ -260,6 +263,7 @@ func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Co
continue
}
level.GetTile(cs).Visible = true
level.GetTile(cs).Explored = true
}
//light walls, crutch
@ -273,6 +277,7 @@ func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Co
(maybeNb.X == cell.X || maybeNb.Y == cell.Y) &&
maybeNb.lit > 0 { //magic constant!
level.GetTile(cs).Visible = true
level.GetTile(cs).Explored = true
}
}
}