~johanvandegriff/ruegolike

21eb3a73dfcd0dc4d10be39a8501426bd54c8738 — Johan Vandegriff 1 year, 4 months ago a151112
fixed some edge cases with half tiles, still have issues with corners
3 files changed, 90 insertions(+), 20 deletions(-)

M chars.txt
M display.go
M main.go
M chars.txt => chars.txt +1 -1
@@ 1,5 1,5 @@
sharp (currently using):
├ ┤ ┬ ┴ ┼ ┌ └ ┐ ┘ ─ │
├ ┤ ┬ ┴ ┼ ┌ └ ┐ ┘ ─ │ ╴ ╵ ╶ ╷

rounded:
╭ ╰ ╮ ╯

M display.go => display.go +88 -18
@@ 320,7 320,7 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
		for y := 0; y < height; y++ {
			if explored1[y][x] {
				char := level.GetChar(Point{x, y})
				if level.GetTile(Point{x, y}).IsRoom() {
				if level.GetTile(Point{x, y}).IsRoom() && char != '*' {
					numFloors := 0
					for x2 := -1; x2 <= 1; x2++ {
						for y2 := -1; y2 <= 1; y2++ {


@@ 331,7 331,7 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
					}
					if numFloors == 0 {
						char = '#'
					} else if level.GetTile(Point{x, y}).IsCorner() { //corner cases :)
					} else {
						// var isRoom [3][3]bool
						// for x2 := -1; x2 <= 1; x2++ {
						// 	for y2 := -1; y2 <= 1; y2++ {


@@ 343,6 343,75 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
						isRoomLeft := isXYInRange(x-1, y) && level.GetTile(Point{x - 1, y}).IsRoom() && explored1[y][x-1]
						isRoomRight := isXYInRange(x+1, y) && level.GetTile(Point{x + 1, y}).IsRoom() && explored1[y][x+1]

						//corner cases :)
						if char == '┌' {
							if isRoomBelow && isRoomRight {
								// char = '┌'
							} else if !isRoomBelow && isRoomRight {
								char = '╶'
							} else if isRoomBelow && !isRoomRight {
								char = '╷'
							} else if !isRoomBelow && !isRoomRight {
								char = '#'
							}
						}
						if char == '└' {
							if isRoomAbove && isRoomRight {
								// char = '└'
							} else if !isRoomAbove && isRoomRight {
								char = '╶'
							} else if isRoomAbove && !isRoomRight {
								char = '╵'
							} else if !isRoomAbove && !isRoomRight {
								char = '#'
							}
						}
						if char == '┐' {
							if isRoomBelow && isRoomLeft {
								// char = '┐'
							} else if !isRoomBelow && isRoomLeft {
								char = '╴'
							} else if isRoomBelow && !isRoomLeft {
								char = '╷'
							} else if !isRoomBelow && !isRoomLeft {
								char = '#'
							}
						}
						if char == '┘' {
							if isRoomAbove && isRoomLeft {
								// char = '┘'
							} else if !isRoomAbove && isRoomLeft {
								char = '╴'
							} else if isRoomAbove && !isRoomLeft {
								char = '╵'
							} else if !isRoomAbove && !isRoomLeft {
								char = '#'
							}
						}

						if char == '─' {
							if isRoomLeft && isRoomRight {
								// char = '─'
							} else if !isRoomLeft && isRoomRight {
								char = '╶'
							} else if isRoomLeft && !isRoomRight {
								char = '╴'
							} else if !isRoomLeft && !isRoomRight {
								char = '#'
							}
						}
						if char == '│' {
							if isRoomAbove && isRoomBelow {
								// char = '│'
							} else if !isRoomAbove && isRoomBelow {
								char = '╷'
							} else if isRoomAbove && !isRoomBelow {
								char = '╵'
							} else if !isRoomAbove && !isRoomBelow {
								char = '#'
							}
						}

						if char == '├' {
							if isRoomAbove && isRoomBelow && isRoomRight {
								// char = '├'


@@ 351,13 420,13 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomAbove && !isRoomBelow && isRoomRight {
								char = '└'
							} else if !isRoomAbove && !isRoomBelow && isRoomRight {
								char = '─'
								char = '╶'
							} else if isRoomAbove && isRoomBelow && !isRoomRight {
								char = '│'
							} else if !isRoomAbove && isRoomBelow && !isRoomRight {
								char = '│'
								char = '╷'
							} else if isRoomAbove && !isRoomBelow && !isRoomRight {
								char = '│'
								char = '╵'
							} else if !isRoomAbove && !isRoomBelow && !isRoomRight {
								char = '#'
							}


@@ 370,13 439,13 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomAbove && !isRoomBelow && isRoomLeft {
								char = '┘'
							} else if !isRoomAbove && !isRoomBelow && isRoomLeft {
								char = '─'
								char = '╴'
							} else if isRoomAbove && isRoomBelow && !isRoomLeft {
								char = '│'
							} else if !isRoomAbove && isRoomBelow && !isRoomLeft {
								char = '│'
								char = '╷'
							} else if isRoomAbove && !isRoomBelow && !isRoomLeft {
								char = '│'
								char = '╵'
							} else if !isRoomAbove && !isRoomBelow && !isRoomLeft {
								char = '#'
							}


@@ 389,13 458,13 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomLeft && !isRoomRight && isRoomBelow {
								char = '┐'
							} else if !isRoomLeft && !isRoomRight && isRoomBelow {
								char = '│'
								char = '╷'
							} else if isRoomLeft && isRoomRight && !isRoomBelow {
								char = '─'
							} else if !isRoomLeft && isRoomRight && !isRoomBelow {
								char = '─'
								char = '╶'
							} else if isRoomLeft && !isRoomRight && !isRoomBelow {
								char = '─'
								char = '╴'
							} else if !isRoomLeft && !isRoomRight && !isRoomBelow {
								char = '#'
							}


@@ 408,17 477,18 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomLeft && !isRoomRight && isRoomAbove {
								char = '┘'
							} else if !isRoomLeft && !isRoomRight && isRoomAbove {
								char = '│'
								char = '╵'
							} else if isRoomLeft && isRoomRight && !isRoomAbove {
								char = '─'
							} else if !isRoomLeft && isRoomRight && !isRoomAbove {
								char = '─'
								char = '╶'
							} else if isRoomLeft && !isRoomRight && !isRoomAbove {
								char = '─'
								char = '╴'
							} else if !isRoomLeft && !isRoomRight && !isRoomAbove {
								char = '#'
							}
						}

						if char == '┼' {
							if isRoomLeft && isRoomRight && isRoomAbove && isRoomBelow {
								// char = '┼'


@@ 435,7 505,7 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomLeft && !isRoomRight && !isRoomAbove && isRoomBelow {
								char = '┐'
							} else if !isRoomLeft && !isRoomRight && !isRoomAbove && isRoomBelow {
								char = '│'
								char = '╷'
							} else if isRoomLeft && isRoomRight && isRoomAbove && !isRoomBelow {
								char = '┴'
							} else if !isRoomLeft && isRoomRight && isRoomAbove && !isRoomBelow {


@@ 443,13 513,13 @@ func Display(s tcell.Screen, playerPos Position, visible *[height][width]bool, e
							} else if isRoomLeft && !isRoomRight && isRoomAbove && !isRoomBelow {
								char = '┘'
							} else if !isRoomLeft && !isRoomRight && isRoomAbove && !isRoomBelow {
								char = '│'
								char = '╵'
							} else if isRoomLeft && isRoomRight && !isRoomAbove && !isRoomBelow {
								char = '─'
							} else if !isRoomLeft && isRoomRight && !isRoomAbove && !isRoomBelow {
								char = '─'
								char = '╶'
							} else if isRoomLeft && !isRoomRight && !isRoomAbove && !isRoomBelow {
								char = '─'
								char = '╴'
							} else if !isRoomLeft && !isRoomRight && !isRoomAbove && !isRoomBelow {
								char = '#'
							}

M main.go => main.go +1 -1
@@ 11,7 11,7 @@ import (

const width, height, depth = 48, 16, 32
const offsetX, offsetY = 1, 2
const debug = true
const debug = false

func main() {
	rand.Seed(time.Now().UnixNano())