resolve conflicts

This commit is contained in:
anton.gurov
2019-11-05 12:42:05 +03:00
33 changed files with 1004 additions and 360 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
@ -270,9 +274,10 @@ func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Co
for _, maybeNb := range ps.CellList {
if //int(maybeNb.distance) == int(cell.distance-1) &&
maybeNb.IsAdjacentTo(&cell.Coords) &&
(maybeNb.X == cell.X || maybeNb.Y == cell.Y) &&
//(maybeNb.X == cell.X || maybeNb.Y == cell.Y) &&
maybeNb.lit > 0 { //magic constant!
level.GetTile(cs).Visible = true
level.GetTile(cs).Explored = true
}
}
}

View File

@ -67,7 +67,7 @@ func TestPrecompShade(t *testing.T) {
if playerCoords.X == x && playerCoords.Y == y {
return "@"
}
result := level.GetTileByXY(x, y).Char
result := level.GetTileByXY(x, y).Glyph.GetGlyph()
if !level.GetTileByXY(x, y).Visible {
result = "?"
}