precomputed shade algo, viewport basic render
This commit is contained in:
@ -26,7 +26,9 @@ func (l *Level) Put (x, y int, tileFunc interface{}) {
|
||||
if tf == nil {
|
||||
l.ctx.Logger().Fatal().Msgf("Got non-tile type to put into level: %v", tf)
|
||||
}
|
||||
l.Tiles[x][y] = tf
|
||||
if l.InBounds(types.Coords{x, y}) {
|
||||
l.Tiles[x][y] = tf
|
||||
}
|
||||
}
|
||||
|
||||
func NewLevel(ctx util.ClientCtx, branch string, depth int) *Level {
|
||||
@ -46,5 +48,5 @@ func NewLevel(ctx util.ClientCtx, branch string, depth int) *Level {
|
||||
|
||||
type Room struct {
|
||||
*types.Rect
|
||||
Center *types.Coords
|
||||
Center types.Coords
|
||||
}
|
@ -22,7 +22,7 @@ func DefaultGen(l *gamemap.Level) *gamemap.Level {
|
||||
}
|
||||
}
|
||||
|
||||
rooms := make([]*gamemap.Room, maxrooms)
|
||||
rooms := make([]*gamemap.Room, 0)
|
||||
|
||||
for i := 0; i < maxrooms; i++ {
|
||||
newRoom := &gamemap.Room{
|
||||
@ -32,8 +32,7 @@ func DefaultGen(l *gamemap.Level) *gamemap.Level {
|
||||
rng.Range(minRoomSize, maxRoomSize),
|
||||
rng.Range(minRoomSize, maxRoomSize),
|
||||
)}
|
||||
newRoom.Center.X = newRoom.X + newRoom.W / 2
|
||||
newRoom.Center.Y = newRoom.Y + newRoom.H / 2
|
||||
newRoom.Center = types.Coords{newRoom.X + newRoom.W / 2, newRoom.Y + newRoom.H / 2}
|
||||
|
||||
failed := false
|
||||
for _, otherRoom := range rooms {
|
||||
|
@ -39,6 +39,7 @@ type Tile struct {
|
||||
BlocksPass bool
|
||||
BlocksSight bool
|
||||
Explored bool
|
||||
Visible bool
|
||||
MustDraw bool
|
||||
Colordance bool
|
||||
}
|
||||
|
Reference in New Issue
Block a user