Skip to content

Commit db7b757

Browse files
committed
Merge branch 'main' of https://github.com/ketMix/ebijam24
2 parents 0bacb92 + 07caeee commit db7b757

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed

internal/game/story.go

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Story struct {
2222
tower *Tower
2323
hasRenderedWalls bool
2424
hasClouds bool
25+
isLast bool
2526
}
2627

2728
// StoryHeight is the height of a story in da tower.
@@ -54,7 +55,7 @@ func NewStoryWithSize(size int) *Story {
5455
room := NewRoom(Small, Stairs, true)
5556
PanicIfErr(story.PlaceRoom(room, 7))
5657

57-
for i := 0; i < 4; i++ {
58+
/*for i := 0; i < 4; i++ {
5859
stack := Must(render.NewStack("walls/pie", "template", ""))
5960
stack.SetRotation(float64(i) * (math.Pi / 2))
6061
@@ -64,7 +65,7 @@ func NewStoryWithSize(size int) *Story {
6465
stack.SetPosition(x, y)
6566
6667
story.stacks.Add(stack)
67-
}
68+
}*/
6869

6970
// Add our walls.
7071
for j := 0; j < 3; j++ {
@@ -237,32 +238,40 @@ func (s *Story) Draw(o *render.Options) {
237238
s.hasRenderedWalls = true
238239
} else {
239240
s.vgroup.Clear()
240-
s.hasRenderedWalls = false
241-
// Conditionally render the walls based upon rotation.
242-
for _, stack := range s.walls {
243-
r := stack.Rotation() + o.TowerRotation
244-
r += math.Pi / 2
245-
246-
// Ensure r is constrained from 0 to 2*math.Pi
247-
for r < 0 {
248-
r += math.Pi * 2
249-
}
250-
for r >= math.Pi*2 {
251-
r -= math.Pi * 2
241+
if s.isLast {
242+
for i, stack := range s.walls {
243+
if i > 8*2 {
244+
stack.Draw(opts)
245+
}
252246
}
247+
} else {
248+
s.hasRenderedWalls = false
249+
// Conditionally render the walls based upon rotation.
250+
for _, stack := range s.walls {
251+
r := stack.Rotation() + o.TowerRotation
252+
r += math.Pi / 2
253+
254+
// Ensure r is constrained from 0 to 2*math.Pi
255+
for r < 0 {
256+
r += math.Pi * 2
257+
}
258+
for r >= math.Pi*2 {
259+
r -= math.Pi * 2
260+
}
253261

254-
min := math.Pi / 4
255-
max := math.Pi * 4 / 4
262+
min := math.Pi / 4
263+
max := math.Pi * 4 / 4
256264

257-
opts.DrawImageOptions.ColorScale.Reset()
265+
opts.DrawImageOptions.ColorScale.Reset()
258266

259-
if r >= min && r < max {
260-
continue
261-
} else if r >= min-math.Pi/4 && r < max+math.Pi/4 {
262-
opts.DrawImageOptions.ColorScale.ScaleAlpha(0.25)
263-
}
267+
if r >= min && r < max {
268+
continue
269+
} else if r >= min-math.Pi/4 && r < max+math.Pi/4 {
270+
opts.DrawImageOptions.ColorScale.ScaleAlpha(0.25)
271+
}
264272

265-
stack.Draw(opts)
273+
stack.Draw(opts)
274+
}
266275
}
267276
opts.DrawImageOptions.ColorScale.Reset()
268277

@@ -525,6 +534,7 @@ func (s *Story) AddClouds() {
525534

526535
stack.SetStaxie("walls/clouds")
527536
stack.SetStack("base")
537+
528538
stack.ColorScale.Reset()
529539
stack.ColorScale.Scale(1, clr, clr, 1)
530540
stack.SliceColorMin = 0.1
@@ -533,6 +543,9 @@ func (s *Story) AddClouds() {
533543
s.hasClouds = true
534544
}
535545
func (s *Story) RemoveClouds() {
546+
if s.isLast {
547+
return
548+
}
536549
for i := 1; i < 3; i++ {
537550
for j := 0; j < 8; j++ {
538551
stack := s.walls[i*8+j]

internal/game/tower.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ func (t *Tower) AddStory(s *Story) {
151151
t.Stories = append(t.Stories, s)
152152
s.tower = t
153153

154+
// FIXME: This needs to be set if the target story is the last one!
155+
/*if t.targetStories-1 == len(t.Stories) {
156+
s.isLast = true
157+
}*/
158+
154159
s.AddClouds()
155160
}
156161

0 commit comments

Comments
 (0)