fixed lit thresholds

This commit is contained in:
anton.gurov
2019-11-07 13:30:37 +03:00
parent dd2e68a8e8
commit e9e6160f9e
6 changed files with 61 additions and 39 deletions

View File

@ -21,8 +21,6 @@ import (
// - Only lighting walls with light from the player (cheap trick, dutch)
// - Match light value for walls with the highest light value in adjacent floor cell visible to player (seems costly)
/*
Why am I here? Well, I just don't know what to call it - I'm sure it's an established method, and I'm aware there are
probably optimisations to be had. I thought if I roughed out the algorithm here, the r/roguelikedev community would
@ -258,7 +256,7 @@ func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Co
for _, cell := range ps.CellList {
//fmt.Printf("\n coords: %v, distance: %f, lit: %d", cell.Coords, cell.distance, cell.lit)
cs, err := ps.toLevelCoords(level, initCoords, cell.Coords)
if cell.lit > 0 {
if cell.lit > 2 {
if err != nil {
continue
}
@ -275,7 +273,7 @@ func (ps *precomputedShade) ComputeFov(level *gamemap.Level, initCoords types.Co
if //int(maybeNb.distance) == int(cell.distance-1) &&
maybeNb.IsAdjacentTo(&cell.Coords) &&
//(maybeNb.X == cell.X || maybeNb.Y == cell.Y) &&
maybeNb.lit > 0 { //magic constant!
maybeNb.lit > 5 { //magic constant!
level.GetTile(cs).Visible = true
level.GetTile(cs).Explored = true
}