This commit is contained in:
2019-10-31 22:47:36 +03:00
parent cddc5fa70f
commit a91351d3dc
6 changed files with 31 additions and 61 deletions

View File

@ -125,61 +125,21 @@ func (vp *ViewPort) Render() {
vp.layer.Clear(vp.Rect)
fovRecompute = false
redraw = true
//fixme
vp.Fov.ComputeFov(vp.level, vp.playerCoords, vp.playerTorchRadius)
}
//for y := 0; y < vp.H; y++ {
// for x := 0; x < vp.W; x++ {
// mapCoords := types.Coords{vp.X + x, vp.Y + y}
// tile := vp.level.Tiles[mapCoords.X][mapCoords.Y]
//
// if tile.Visible {
// if tile.MustDraw {
// //darkened version of landscape
// vp.layer.WithRawColor(tile.ColorSet.DarkFg()).
// PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.DarkBg())
// }
// } else {
// if redraw == true || tile.Colordance {
// vp.layer.WithRawColor(tile.ColorSet.Fg()).
// PutWithRawBackground(mapCoords.X, mapCoords.Y, tile.Char, tile.ColorSet.Bg())
// tile.Explored = true
// tile.MustDraw = true
// }
// }
// }
//}
if redraw {
for y := 0; y < vp.H; y++ {
for x := 0; x < vp.W; x++ {
mapCoords := types.Coords{vp.X + x, vp.Y + y}
for y := 0; y < vp.H; y++ {
for x := 0; x < vp.W; x++ {
mapCoords := types.Coords{vp.X + x, vp.Y + y}
//vp.level.GetTile(mapCoords).Render()
tile := vp.level.GetTile(mapCoords)
//vp.layer.
// WithRawColor(tile.GetRawColor()).
// PutWithBackground(mapCoords.X, mapCoords.Y, tile.GetChar(), "grey")
vp.layer.PutToBase(mapCoords.X,mapCoords.Y,tile.GetChar(), tile.GetRawColor(), tile.GetRawBgColor())
//if tile.Visible {
// if tile.MustDraw {
// //darkened version of landscape
// vp.layer.WithColor("green").
// Put(mapCoords.X, mapCoords.Y, tile.Char)
// }
//} else {
// if redraw == true || tile.Colordance {
// vp.layer.WithColor("grey").
// Put(mapCoords.X, mapCoords.Y, tile.Char)
// tile.Explored = true
// tile.MustDraw = true
// }
//}
tile := vp.level.GetTile(mapCoords)
if tile.Explored || tile.MustDraw || tile.Visible {
vp.layer.PutToBase(mapCoords.X, mapCoords.Y, tile.GetChar(), tile.GetRawColor(), tile.GetRawBgColor())
}
}
}
//redraw = false
}
}