@@ -22,6 +22,7 @@ type Story struct {
22
22
tower * Tower
23
23
hasRenderedWalls bool
24
24
hasClouds bool
25
+ isLast bool
25
26
}
26
27
27
28
// StoryHeight is the height of a story in da tower.
@@ -54,7 +55,7 @@ func NewStoryWithSize(size int) *Story {
54
55
room := NewRoom (Small , Stairs , true )
55
56
PanicIfErr (story .PlaceRoom (room , 7 ))
56
57
57
- for i := 0 ; i < 4 ; i ++ {
58
+ /* for i := 0; i < 4; i++ {
58
59
stack := Must(render.NewStack("walls/pie", "template", ""))
59
60
stack.SetRotation(float64(i) * (math.Pi / 2))
60
61
@@ -64,7 +65,7 @@ func NewStoryWithSize(size int) *Story {
64
65
stack.SetPosition(x, y)
65
66
66
67
story.stacks.Add(stack)
67
- }
68
+ }*/
68
69
69
70
// Add our walls.
70
71
for j := 0 ; j < 3 ; j ++ {
@@ -237,32 +238,40 @@ func (s *Story) Draw(o *render.Options) {
237
238
s .hasRenderedWalls = true
238
239
} else {
239
240
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
+ }
252
246
}
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
+ }
253
261
254
- min := math .Pi / 4
255
- max := math .Pi * 4 / 4
262
+ min := math .Pi / 4
263
+ max := math .Pi * 4 / 4
256
264
257
- opts .DrawImageOptions .ColorScale .Reset ()
265
+ opts .DrawImageOptions .ColorScale .Reset ()
258
266
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
+ }
264
272
265
- stack .Draw (opts )
273
+ stack .Draw (opts )
274
+ }
266
275
}
267
276
opts .DrawImageOptions .ColorScale .Reset ()
268
277
@@ -525,6 +534,7 @@ func (s *Story) AddClouds() {
525
534
526
535
stack .SetStaxie ("walls/clouds" )
527
536
stack .SetStack ("base" )
537
+
528
538
stack .ColorScale .Reset ()
529
539
stack .ColorScale .Scale (1 , clr , clr , 1 )
530
540
stack .SliceColorMin = 0.1
@@ -533,6 +543,9 @@ func (s *Story) AddClouds() {
533
543
s .hasClouds = true
534
544
}
535
545
func (s * Story ) RemoveClouds () {
546
+ if s .isLast {
547
+ return
548
+ }
536
549
for i := 1 ; i < 3 ; i ++ {
537
550
for j := 0 ; j < 8 ; j ++ {
538
551
stack := s .walls [i * 8 + j ]
0 commit comments