- Exploration uses Up/Down + Enter instead of number keys - Adjacent rooms shown with cursor selection in HUD - Neighboring rooms visible on fog of war map - Room numbers displayed on tile map with type-colored markers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
685 B
Go
36 lines
685 B
Go
package dungeon
|
|
|
|
type Visibility int
|
|
|
|
const (
|
|
Hidden Visibility = iota
|
|
Visited
|
|
Visible
|
|
)
|
|
|
|
func UpdateVisibility(floor *Floor) {
|
|
for i, room := range floor.Rooms {
|
|
if i == floor.CurrentRoom {
|
|
room.Visited = true
|
|
}
|
|
}
|
|
}
|
|
|
|
func GetRoomVisibility(floor *Floor, roomIdx int) Visibility {
|
|
if roomIdx == floor.CurrentRoom {
|
|
return Visible
|
|
}
|
|
if floor.Rooms[roomIdx].Visited {
|
|
return Visited
|
|
}
|
|
// Neighbors of current room are dimly visible (so player can see where to go)
|
|
if floor.CurrentRoom >= 0 && floor.CurrentRoom < len(floor.Rooms) {
|
|
for _, n := range floor.Rooms[floor.CurrentRoom].Neighbors {
|
|
if n == roomIdx {
|
|
return Visited
|
|
}
|
|
}
|
|
}
|
|
return Hidden
|
|
}
|