Merge branch 'glow_effects'
authorLMH <lmh.0013@gmail.com>
Fri, 19 Jul 2013 20:14:49 +0000 (10:14 -1000)
committerLMH <lmh.0013@gmail.com>
Fri, 19 Jul 2013 20:14:49 +0000 (10:14 -1000)
Several enhancements to make dark levels more viable by adding a glow to several objects.  Candles have additional functionality to allow for many custom ambient lighting effects.  An ice vulnerability is also added to flame badguys; in addition, a fire vulnerable and invulnerable version of flame is added.  Finally a spiky-like badguy, LiveFire, is added which offers a sleeping and dormant (does not wake) state as well.  The effects can be observed in the added test level: "Glow Effects Test".

TODO: LiveFire graphics, regular level(s) intoducing the effects, and the addition of new sprites for candles would be nice.

77 files changed:
data/images/creatures/flame/flame-fade-0.png [new file with mode: 0644]
data/images/creatures/flame/flame-fade-1.png [new file with mode: 0644]
data/images/creatures/flame/flame-fade-2.png [new file with mode: 0644]
data/images/creatures/flame/flame-fade-3.png [new file with mode: 0644]
data/images/creatures/flame/flame.sprite
data/images/creatures/flame/ghostflame-0.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-1.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-2.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-3.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-4.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-editor.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame.sprite [new file with mode: 0644]
data/images/creatures/flame/ghostflame.xcf [new file with mode: 0644]
data/images/creatures/flame/iceflame-editor.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-0.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-1.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-2.png [new file with mode: 0644]
data/images/creatures/flame/iceflame.png [new file with mode: 0644]
data/images/creatures/flame/iceflame.sprite [new file with mode: 0644]
data/images/creatures/livefire/left-0.png [new file with mode: 0644]
data/images/creatures/livefire/left-1.png [new file with mode: 0644]
data/images/creatures/livefire/left-2.png [new file with mode: 0644]
data/images/creatures/livefire/livefire.sprite [new file with mode: 0644]
data/images/creatures/livefire/sleeping-left.png [new file with mode: 0644]
data/images/creatures/livefire/waking-left-0.png [new file with mode: 0644]
data/images/creatures/livefire/waking-left-1.png [new file with mode: 0644]
data/images/creatures/livefire/waking-left-2.png [new file with mode: 0644]
data/images/objects/candle/candle-light-1.sprite [new file with mode: 0644]
data/images/objects/candle/candle-light-2.sprite [new file with mode: 0644]
data/images/objects/candle/candle-light-white-1.png [new file with mode: 0644]
data/images/objects/candle/candle-light-white-2.png [new file with mode: 0644]
data/images/objects/candle/torch/torch-off.png [new file with mode: 0644]
data/images/objects/candle/torch/torch.sprite [new file with mode: 0644]
data/images/objects/candle/torch/torch1.png [new file with mode: 0755]
data/images/objects/candle/torch/torch2.png [new file with mode: 0755]
data/images/objects/candle/torch/torch3.png [new file with mode: 0755]
data/images/objects/candle/torch/torch4.png [new file with mode: 0755]
data/images/objects/lightmap_light/lightmap_light-large.png [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-large.sprite [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-medium.png [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-medium.sprite [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-small.png [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-small.sprite [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-tiny.png [new file with mode: 0644]
data/images/objects/lightmap_light/lightmap_light-tiny.sprite [new file with mode: 0644]
data/levels/test/glow_effects.stl [new file with mode: 0755]
src/badguy/flame.cpp
src/badguy/flame.hpp
src/badguy/ghostflame.cpp [new file with mode: 0644]
src/badguy/ghostflame.hpp [new file with mode: 0644]
src/badguy/iceflame.cpp [new file with mode: 0644]
src/badguy/iceflame.hpp [new file with mode: 0644]
src/badguy/kugelblitz.cpp
src/badguy/kugelblitz.hpp
src/badguy/livefire.cpp [new file with mode: 0644]
src/badguy/livefire.hpp [new file with mode: 0644]
src/badguy/willowisp.cpp
src/badguy/willowisp.hpp
src/object/bullet.cpp
src/object/bullet.hpp
src/object/candle.cpp
src/object/candle.hpp
src/object/explosion.cpp
src/object/explosion.hpp
src/object/flower.cpp
src/object/flower.hpp
src/object/growup.cpp
src/object/growup.hpp
src/object/powerup.cpp
src/object/powerup.hpp
src/object/sprite_particle.cpp
src/object/sprite_particle.hpp
src/object/star.cpp
src/object/star.hpp
src/object/weak_block.cpp
src/object/weak_block.hpp
src/supertux/object_factory.cpp

diff --git a/data/images/creatures/flame/flame-fade-0.png b/data/images/creatures/flame/flame-fade-0.png
new file mode 100644 (file)
index 0000000..55be7eb
Binary files /dev/null and b/data/images/creatures/flame/flame-fade-0.png differ
diff --git a/data/images/creatures/flame/flame-fade-1.png b/data/images/creatures/flame/flame-fade-1.png
new file mode 100644 (file)
index 0000000..23ab72a
Binary files /dev/null and b/data/images/creatures/flame/flame-fade-1.png differ
diff --git a/data/images/creatures/flame/flame-fade-2.png b/data/images/creatures/flame/flame-fade-2.png
new file mode 100644 (file)
index 0000000..75aba36
Binary files /dev/null and b/data/images/creatures/flame/flame-fade-2.png differ
diff --git a/data/images/creatures/flame/flame-fade-3.png b/data/images/creatures/flame/flame-fade-3.png
new file mode 100644 (file)
index 0000000..2fa787b
Binary files /dev/null and b/data/images/creatures/flame/flame-fade-3.png differ
index 81a447a..3bf4e35 100644 (file)
@@ -5,6 +5,15 @@
   (images "flame-0.png"
           "flame-1.png"))
  (action
+  (hitbox 0 0 31.8 31.8)
+  (name "fade")
+  (fps 5)
+  (images "flame-1.png"
+          "flame-fade-0.png"
+          "flame-fade-1.png"
+          "flame-fade-2.png"
+          "flame-fade-3.png"))
+ (action
   (hitbox 96 96 127.8 31.8)
   (name "editor")
   (images "flame-editor.png"))
diff --git a/data/images/creatures/flame/ghostflame-0.png b/data/images/creatures/flame/ghostflame-0.png
new file mode 100644 (file)
index 0000000..18e0eae
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-0.png differ
diff --git a/data/images/creatures/flame/ghostflame-1.png b/data/images/creatures/flame/ghostflame-1.png
new file mode 100644 (file)
index 0000000..b5ddef9
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-1.png differ
diff --git a/data/images/creatures/flame/ghostflame-2.png b/data/images/creatures/flame/ghostflame-2.png
new file mode 100644 (file)
index 0000000..99bc839
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-2.png differ
diff --git a/data/images/creatures/flame/ghostflame-3.png b/data/images/creatures/flame/ghostflame-3.png
new file mode 100644 (file)
index 0000000..7a4c763
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-3.png differ
diff --git a/data/images/creatures/flame/ghostflame-4.png b/data/images/creatures/flame/ghostflame-4.png
new file mode 100644 (file)
index 0000000..280cf0b
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-4.png differ
diff --git a/data/images/creatures/flame/ghostflame-editor.png b/data/images/creatures/flame/ghostflame-editor.png
new file mode 100644 (file)
index 0000000..f13234a
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-editor.png differ
diff --git a/data/images/creatures/flame/ghostflame.sprite b/data/images/creatures/flame/ghostflame.sprite
new file mode 100644 (file)
index 0000000..a940ec5
--- /dev/null
@@ -0,0 +1,16 @@
+(supertux-sprite
+ (action
+  (hitbox 0.2 0.2 31.6 31.6)
+  (name "normal")
+  (images "ghostflame-0.png"
+          "ghostflame-1.png"
+          "ghostflame-2.png"
+          "ghostflame-3.png"
+          "ghostflame-4.png"))
+ (action
+  (hitbox 96 96 127.8 31.8)
+  (name "editor")
+  (images "ghostflame-editor.png"))
+
+)
+
diff --git a/data/images/creatures/flame/ghostflame.xcf b/data/images/creatures/flame/ghostflame.xcf
new file mode 100644 (file)
index 0000000..d0662b4
Binary files /dev/null and b/data/images/creatures/flame/ghostflame.xcf differ
diff --git a/data/images/creatures/flame/iceflame-editor.png b/data/images/creatures/flame/iceflame-editor.png
new file mode 100644 (file)
index 0000000..235e98b
Binary files /dev/null and b/data/images/creatures/flame/iceflame-editor.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-0.png b/data/images/creatures/flame/iceflame-fade-0.png
new file mode 100644 (file)
index 0000000..22b5608
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-0.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-1.png b/data/images/creatures/flame/iceflame-fade-1.png
new file mode 100644 (file)
index 0000000..262b283
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-1.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-2.png b/data/images/creatures/flame/iceflame-fade-2.png
new file mode 100644 (file)
index 0000000..bf132e1
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-2.png differ
diff --git a/data/images/creatures/flame/iceflame.png b/data/images/creatures/flame/iceflame.png
new file mode 100644 (file)
index 0000000..b48079b
Binary files /dev/null and b/data/images/creatures/flame/iceflame.png differ
diff --git a/data/images/creatures/flame/iceflame.sprite b/data/images/creatures/flame/iceflame.sprite
new file mode 100644 (file)
index 0000000..1c02b68
--- /dev/null
@@ -0,0 +1,18 @@
+(supertux-sprite
+ (action
+  (hitbox 0 0 31.8 31.8)
+  (name "normal")
+  (images "iceflame.png"))
+ (action
+  (hitbox 0 0 31.8 31.8)
+  (name "fade")
+  (fps 5)
+  (images "iceflame-fade-0.png"
+          "iceflame-fade-1.png"
+          "iceflame-fade-2.png"))
+ (action
+  (hitbox 96 96 127.8 31.8)
+  (name "editor")
+  (images "iceflame-editor.png"))
+)
+
diff --git a/data/images/creatures/livefire/left-0.png b/data/images/creatures/livefire/left-0.png
new file mode 100644 (file)
index 0000000..6a0cd01
Binary files /dev/null and b/data/images/creatures/livefire/left-0.png differ
diff --git a/data/images/creatures/livefire/left-1.png b/data/images/creatures/livefire/left-1.png
new file mode 100644 (file)
index 0000000..d773b0a
Binary files /dev/null and b/data/images/creatures/livefire/left-1.png differ
diff --git a/data/images/creatures/livefire/left-2.png b/data/images/creatures/livefire/left-2.png
new file mode 100644 (file)
index 0000000..6b9721f
Binary files /dev/null and b/data/images/creatures/livefire/left-2.png differ
diff --git a/data/images/creatures/livefire/livefire.sprite b/data/images/creatures/livefire/livefire.sprite
new file mode 100644 (file)
index 0000000..0bad70a
--- /dev/null
@@ -0,0 +1,32 @@
+(supertux-sprite
+ (action
+  (name "left")
+  (hitbox 6 10 31.8 31.8)
+  (images "left-0.png"
+   "left-1.png"
+   "left-2.png"))
+ (action
+  (name "right")
+  (hitbox 6 10 31.8 31.8)
+  (mirror-action "left"))
+ (action
+  (name "sleeping-left")
+  (hitbox 6 10 31.8 31.8)
+  (images "sleeping-left.png"))
+ (action
+  (name "sleeping-right")
+  (hitbox 6 10 31.8 31.8)
+  (mirror-action "sleeping-left"))
+ (action
+  (name "waking-left")
+  (hitbox 6 10 31.8 31.8)
+  (fps 6.0)
+  (images "waking-left-0.png"
+   "waking-left-1.png"
+   "waking-left-2.png"))
+ (action
+  (name "waking-right")
+  (fps 6.0)
+  (hitbox 6 10 31.8 31.8)
+  (mirror-action "waking-left"))
+)
diff --git a/data/images/creatures/livefire/sleeping-left.png b/data/images/creatures/livefire/sleeping-left.png
new file mode 100644 (file)
index 0000000..fcbacb2
Binary files /dev/null and b/data/images/creatures/livefire/sleeping-left.png differ
diff --git a/data/images/creatures/livefire/waking-left-0.png b/data/images/creatures/livefire/waking-left-0.png
new file mode 100644 (file)
index 0000000..272cd3f
Binary files /dev/null and b/data/images/creatures/livefire/waking-left-0.png differ
diff --git a/data/images/creatures/livefire/waking-left-1.png b/data/images/creatures/livefire/waking-left-1.png
new file mode 100644 (file)
index 0000000..637654f
Binary files /dev/null and b/data/images/creatures/livefire/waking-left-1.png differ
diff --git a/data/images/creatures/livefire/waking-left-2.png b/data/images/creatures/livefire/waking-left-2.png
new file mode 100644 (file)
index 0000000..d773b0a
Binary files /dev/null and b/data/images/creatures/livefire/waking-left-2.png differ
diff --git a/data/images/objects/candle/candle-light-1.sprite b/data/images/objects/candle/candle-light-1.sprite
new file mode 100644 (file)
index 0000000..cbad448
--- /dev/null
@@ -0,0 +1,12 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "candle-light-1.png")
+      (hitbox 256 256 0 0)
+    )
+    (action
+      (name "white")
+      (images "candle-light-white-1.png")
+      (hitbox 256 256 0 0)
+    )
+)
diff --git a/data/images/objects/candle/candle-light-2.sprite b/data/images/objects/candle/candle-light-2.sprite
new file mode 100644 (file)
index 0000000..80529f2
--- /dev/null
@@ -0,0 +1,12 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "candle-light-2.png")
+      (hitbox 256 256 0 0)
+    )
+    (action
+      (name "white")
+      (images "candle-light-white-2.png")
+      (hitbox 256 256 0 0)
+    )
+)
diff --git a/data/images/objects/candle/candle-light-white-1.png b/data/images/objects/candle/candle-light-white-1.png
new file mode 100644 (file)
index 0000000..c44072d
Binary files /dev/null and b/data/images/objects/candle/candle-light-white-1.png differ
diff --git a/data/images/objects/candle/candle-light-white-2.png b/data/images/objects/candle/candle-light-white-2.png
new file mode 100644 (file)
index 0000000..7085836
Binary files /dev/null and b/data/images/objects/candle/candle-light-white-2.png differ
diff --git a/data/images/objects/candle/torch/torch-off.png b/data/images/objects/candle/torch/torch-off.png
new file mode 100644 (file)
index 0000000..b83dc51
Binary files /dev/null and b/data/images/objects/candle/torch/torch-off.png differ
diff --git a/data/images/objects/candle/torch/torch.sprite b/data/images/objects/candle/torch/torch.sprite
new file mode 100644 (file)
index 0000000..d86176f
--- /dev/null
@@ -0,0 +1,18 @@
+(supertux-sprite
+  (action
+    (name "on")
+    (images 
+      "torch1.png"
+      "torch2.png"
+      "torch3.png"
+      )
+    )
+  (action
+    (name "off")
+    (hitbox 0 -32 32 32)
+    (images 
+      "torch-off.png"
+      )
+    )
+  )
+
diff --git a/data/images/objects/candle/torch/torch1.png b/data/images/objects/candle/torch/torch1.png
new file mode 100755 (executable)
index 0000000..475bbdb
Binary files /dev/null and b/data/images/objects/candle/torch/torch1.png differ
diff --git a/data/images/objects/candle/torch/torch2.png b/data/images/objects/candle/torch/torch2.png
new file mode 100755 (executable)
index 0000000..340a406
Binary files /dev/null and b/data/images/objects/candle/torch/torch2.png differ
diff --git a/data/images/objects/candle/torch/torch3.png b/data/images/objects/candle/torch/torch3.png
new file mode 100755 (executable)
index 0000000..60757fb
Binary files /dev/null and b/data/images/objects/candle/torch/torch3.png differ
diff --git a/data/images/objects/candle/torch/torch4.png b/data/images/objects/candle/torch/torch4.png
new file mode 100755 (executable)
index 0000000..897245a
Binary files /dev/null and b/data/images/objects/candle/torch/torch4.png differ
diff --git a/data/images/objects/lightmap_light/lightmap_light-large.png b/data/images/objects/lightmap_light/lightmap_light-large.png
new file mode 100644 (file)
index 0000000..53662bc
Binary files /dev/null and b/data/images/objects/lightmap_light/lightmap_light-large.png differ
diff --git a/data/images/objects/lightmap_light/lightmap_light-large.sprite b/data/images/objects/lightmap_light/lightmap_light-large.sprite
new file mode 100644 (file)
index 0000000..94ee84c
--- /dev/null
@@ -0,0 +1,7 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "lightmap_light-large.png")
+      (hitbox 512 512 0 0)
+    )
+)
diff --git a/data/images/objects/lightmap_light/lightmap_light-medium.png b/data/images/objects/lightmap_light/lightmap_light-medium.png
new file mode 100644 (file)
index 0000000..66fe8c0
Binary files /dev/null and b/data/images/objects/lightmap_light/lightmap_light-medium.png differ
diff --git a/data/images/objects/lightmap_light/lightmap_light-medium.sprite b/data/images/objects/lightmap_light/lightmap_light-medium.sprite
new file mode 100644 (file)
index 0000000..670a152
--- /dev/null
@@ -0,0 +1,7 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "lightmap_light-medium.png")
+      (hitbox 192 192 0 0)
+    )
+)
diff --git a/data/images/objects/lightmap_light/lightmap_light-small.png b/data/images/objects/lightmap_light/lightmap_light-small.png
new file mode 100644 (file)
index 0000000..f4239c3
Binary files /dev/null and b/data/images/objects/lightmap_light/lightmap_light-small.png differ
diff --git a/data/images/objects/lightmap_light/lightmap_light-small.sprite b/data/images/objects/lightmap_light/lightmap_light-small.sprite
new file mode 100644 (file)
index 0000000..350efca
--- /dev/null
@@ -0,0 +1,7 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "lightmap_light-small.png")
+      (hitbox 64 64 0 0)
+    )
+)
diff --git a/data/images/objects/lightmap_light/lightmap_light-tiny.png b/data/images/objects/lightmap_light/lightmap_light-tiny.png
new file mode 100644 (file)
index 0000000..efeadd2
Binary files /dev/null and b/data/images/objects/lightmap_light/lightmap_light-tiny.png differ
diff --git a/data/images/objects/lightmap_light/lightmap_light-tiny.sprite b/data/images/objects/lightmap_light/lightmap_light-tiny.sprite
new file mode 100644 (file)
index 0000000..841be38
--- /dev/null
@@ -0,0 +1,7 @@
+(supertux-sprite
+    (action
+      (name "default")
+      (images "lightmap_light-tiny.png")
+      (hitbox 32 32 0 0)
+    )
+)
diff --git a/data/levels/test/glow_effects.stl b/data/levels/test/glow_effects.stl
new file mode 100755 (executable)
index 0000000..be3cb58
--- /dev/null
@@ -0,0 +1,135 @@
+(supertux-level                                                                                                                                                                                                                                                                                                                                                        
+       (version 2)                                                                                                                                                                                                                                                                                                                                             
+       (name (_ "Glow Effects Test"))                                                                                                                                                                                                                                                                                                                                          
+       (author "LMH")                                                                                                                                                                                                                                                                                                                                          
+       (license        "GPL 2 / CC-by-sa 3.0"  )                                                                                                                                                                                                                                                                                                                               
+       (sector (name   "main"  )                                                                                                                                                                                                                                                                                                                       
+               (ambient-light  0.02    0.02    0.02    )                                                                                                                                                                                                                                                                                                       
+               (camera (mode   "normal"        ))                                                                                                                                                                                                                                                                                                              
+               (music   "music/voc-dark.ogg"   )                                                                                                                                                                                                                                                                                                                       
+
+               (spawnpoint     (name   "main"  )
+                       (x      64      )(y     448     ))
+               (spawnpoint     (name   "top"   )
+                       (x      656     )(y     288     ))
+
+
+               (mrbomb (x      832     )(y     736     ))                                                                                                                                                                                                                                                                                              
+               (short_fuse     (x      1056    )(y     736     ))                                                                                                                                                                                                                                                                                              
+               (short_fuse     (x      1152    )(y     736     ))                                                                                                                                                                                                                                                                                              
+               (short_fuse     (x      1248    )(y     736     ))                                                                                                                                                                                                                                                                                              
+               (haywire        (x      928     )(y     736     ))                                                                                                                                                                                                                                                                                              
+               (flame  (x      576     )(y     480     )(speed 0.2))
+               (iceflame       (x      736     )(y     480     )(speed 0.2))
+               (ghostflame     (x      656     )(y     96      ))
+    (livefire (x 224 )(y 192 ))
+    (livefire_asleep (x 64 )(y 192 )(direction "right"))
+    (livefire_dormant (x 128)(y 192))
+
+               (tilemap        (name   "Interactive"   )                                                                                                                                                                                                                                                                                                               
+                       (z-pos  0       )(solid #t      )                                                                                                                                                                                                                                                                                               
+                       (width  42      )(height        30      )                                                                                                                                                                                                                                                                                               
+                       (tiles  ;       160     192     224     256     288     320     352     384     416     448     480     512     544     576     608     640     672     704     736     768     800     832     864     896     928     960     992     1024    1056    1088    1120    1152    1184    1216    1248    1280    1312            
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0               
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       32
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       64
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       96
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       128
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       160
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       192
+48     48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      ;       224
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       256
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       130     133     ;       288
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       129     133     ;       320
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       2817    0       1408    1388    0       2817    0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       1408    1412    1412    ;       352
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       384
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       416
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       448
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       1408    1412    1412    1412    1412    1412    1412    1412    1412    1388    0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       480
+48     48      48      48      48      48      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       48      48      48      48      48      48      48      48      48      ;       512
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       544
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       576
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       608
+0      0       0       0       0       0       0       0       48      48      48      48      48      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       640
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       672
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       704
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       48      48      ;       736
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       768
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       800
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       832
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       864
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      0       0       0       0       48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       896
+48     48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      2136    2137    2138    2139    48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      48      ;       928
+               ))                                                                                                                                                                                                                                                                                                                                      
+                                                                                                                                                                                                                                                                                                                                                       
+               (candle (x      128     )(y     480     ))                                                                                                                                                                                                                                                                                              
+               (candle (x      96      )(y     736     )(color 1       0       0       )(name  "red"   ))                                                                                                                                                                                                                                              
+               (candle (x      320     )(y     736     )(color 1       0.5     0       )(name  "orange"        ))                                                                                                                                                                                                                                              
+               (candle (x      544     )(y     736     )(color 1       1       0       )(name  "yellow"        ))                                                                                                                                                                                                                                              
+               (candle (x      768     )(y     736     )(color 0       1       0       )(name  "green" ))                                                                                                                                                                                                                                              
+               (candle (x      992     )(y     736     )(color 0       0       1       )(name  "blue"  ))                                                                                                                                                                                                                                              
+               (candle (x      1216    )(y     736     )(color 0.5     0       0.5     )(name  "purple"        ))                                                                                                                                                                                                                                              
+               (candle (x      1184    )(y     480     )(color 1       1       1       ))                                                                                                                                                                                                                                                              
+                                                                                                                                                                                                                                                                                                                                                       
+               (candle (x      608     )(y     960     )(color 0.4     0.1     0       )(flicker       #f      ))                                                                                                                                                                                                                                              
+               (candle (x      640     )(y     960     )(color 0.4     0.1     0       )(flicker       #f      ))                                                                                                                                                                                                                                              
+               (candle (x      672     )(y     960     )(color 0.4     0.1     0       )(flicker       #f      ))                                                                                                                                                                                                                                              
+               (candle (x      704     )(y     960     )(color 0.4     0.1     0       )(flicker       #f      ))                                                                                                                                                                                                                                              
+                                                                                                                                                                                                                                                                                                                                                       
+               (candle (x      576     )(y     320     )(color 1       0.2     0.05    )(name  "torch1"        )(sprite        "images/objects/candle/torch/torch.sprite"      )(burning       #f      ))                                                                                                                                                                                                              
+               (candle (x      736     )(y     320     )(color 1       0.2     0.05    )(name  "torch2"        )(sprite        "images/objects/candle/torch/torch.sprite"      )(burning       #f      ))                                                                                                                                                                                                              
+                                                                                                                                                                                                                                                                                                                                                       
+               (switch (script "       red.set_burning(!red.get_burning());                                                                                                                                                                                                                                                                                                                    
+                               wait(   0.1     );                                                                                                                                                                                                                                                                                                      
+                               orange.set_burning(!orange.get_burning());                                                                                                                                                                                                                                                                                                                      
+                               wait(   0.1     );                                                                                                                                                                                                                                                                                                      
+                               yellow.set_burning(!yellow.get_burning());                                                                                                                                                                                                                                                                                                                      
+                               wait(   0.1     );                                                                                                                                                                                                                                                                                                      
+                               green.set_burning(!green.get_burning());                                                                                                                                                                                                                                                                                                                        
+                               wait(   0.1     );                                                                                                                                                                                                                                                                                                      
+                               blue.set_burning(!blue.get_burning());                                                                                                                                                                                                                                                                                                                  
+                               wait(   0.1     );                                                                                                                                                                                                                                                                                                      
+                               purple.set_burning(!purple.get_burning());      ")(sprite       "images/objects/switch/switch.sprite"   )                                                                                                                                                                                                                                                                                               
+                       (x      96      )(y     448     ))                                                                                                                                                                                                                                                                                              
+                                                                                                                                                                                                                                                                                                                                                       
+               (switch (script "       torch1.set_burning(!torch1.get_burning());                                                                                                                                                                                                                                                                                                                      
+                               torch2.set_burning(!torch2.get_burning());      ")(sprite       "images/objects/switch/switch.sprite"   )                                                                                                                                                                                                                                                                                               
+                       (x      1216    )(y     448     ))                                                                                                                                                                                                                                                                                              
+               (switch (script "       settings.set_ambient_light((settings.get_ambient_red() + 0.14 > 1) ? 0.02 : settings.get_ambient_red() + 0.14 , (settings.get_ambient_green() + 0.14 > 1) ? 0.02 : settings.get_ambient_green() + 0.14 , (settings.get_ambient_blue() + 0.14 > 1) ? 0.02 : settings.get_ambient_blue() + 0.14 );        ")(sprite       "images/objects/switch/switch.sprite"   )                                                                                                                                                                                                                                                                                               
+                       (x      320     )(y     576     ))                                                                                                                                                                                                                                                                                              
+                                                                                                                                                                                                                                                                                                                                                       
+               (bonusblock     (x      544     )(y     352     )(contents      "icegrow"       )(count 0       ))                                                                                                                                                                                                                                                              
+               (bonusblock     (x      608     )(y     352     )(contents      "star"  )(count 0       ))                                                                                                                                                                                                                                                              
+               (bonusblock     (x      704     )(y     352     )(contents      "1up"   )(count 0       ))                                                                                                                                                                                                                                                              
+               (bonusblock     (x      768     )(y     352     )(contents      "firegrow"      )(count 0       ))                                                                                                                                                                                                                                                              
+
+    (willowisp (x 48 )(y 544)(spawnpoint "top" ))
+    (willowisp (x 1232 )(y 544)(spawnpoint "top" ))
+
+    (powerup (x 0 )(y 320 )(sprite "images/powerups/iceflower/iceflower.sprite" ))
+    (powerup (x 0 )(y 480 )(sprite "images/powerups/fireflower/fireflower.sprite" ))
+
+    (weak_block (x 0 )(y 352 )(linked #f ))
+    (weak_block (x 32 )(y 352 ))
+    (weak_block (x 64 )(y 352 ))
+    (weak_block (x 96 )(y 352 ))
+    (weak_block (x 128 )(y 352 ))
+    (weak_block (x 160 )(y 352 ))
+
+    (magicblock (x 416 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 448 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 480 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 512 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 544 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 576 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 608 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 640 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 672 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 704 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 736 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 768 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 800 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 832 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 864 )(y 224 )(color 1 1 1 ))
+    (magicblock (x 896 )(y 224 )(color 1 1 1 ))
+))                                                                                                                                                                                                                                                                                                                                                     
index 5387b74..d061f67 100644 (file)
 #include <math.h>
 
 #include "audio/sound_manager.hpp"
+#include "math/random_generator.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object/sprite_particle.hpp"
 #include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
 #include "util/reader.hpp"
 
 static const std::string FLAME_SOUND = "sounds/flame.wav";
@@ -29,6 +34,9 @@ Flame::Flame(const Reader& reader) :
   angle(0), 
   radius(100), 
   speed(2),
+  fading(false),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")),
   sound_source()
 {
   reader.get("radius", radius);
@@ -39,6 +47,9 @@ Flame::Flame(const Reader& reader) :
   sound_manager->preload(FLAME_SOUND);
 
   set_colgroup_active(COLGROUP_TOUCHABLE);
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.21f, 0.13f, 0.08f));
 }
 
 void
@@ -50,6 +61,27 @@ Flame::active_update(float elapsed_time)
   movement = newpos - get_pos();
 
   sound_source->set_position(get_pos());
+  
+  if(fading)
+    if (sprite->animation_done()) remove_me();
+}
+
+void
+Flame::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if dark
+  if(true){
+    context.get_light( get_bbox().get_middle(), &light );
+    if (light.red + light.green < 2.0){
+      context.push_target();
+      context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, get_pos(), layer);
+      lightsprite->draw(context, get_bbox().get_middle(), 0);
+      context.pop_target();
+    }
+  }
 }
 
 void
@@ -69,9 +101,32 @@ Flame::deactivate()
   sound_source.reset();
 }
 
+
 void
 Flame::kill_fall()
 {
 }
 
+void
+Flame::freeze()
+{
+  //TODO: get unique death sound
+  sound_manager->play("sounds/fizz.wav", get_pos());
+  sprite->set_action("fade", 1);
+  Vector ppos = bbox.get_middle();
+  Vector pspeed = Vector(0, -150);
+  Vector paccel = Vector(0,0);
+  Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
+  fading = true;
+  
+  // start dead-script
+  run_dead_script();
+}
+
+bool
+Flame::is_freezable() const
+{
+  return true;
+}
+
 /* EOF */
index bc04b7e..4e5abd0 100644 (file)
@@ -31,12 +31,19 @@ public:
   void deactivate();
 
   void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
   void kill_fall();
 
+  void freeze();
+  bool is_freezable() const;
+
 private:
   float angle;
   float radius;
   float speed;
+  bool fading;
+  Color light;
+  SpritePtr lightsprite;
 
   std::auto_ptr<SoundSource> sound_source;
 };
diff --git a/src/badguy/ghostflame.cpp b/src/badguy/ghostflame.cpp
new file mode 100644 (file)
index 0000000..f731e56
--- /dev/null
@@ -0,0 +1,85 @@
+//  SuperTux badguy - Ghostflame a flame-like enemy that cannot be killed
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "badguy/ghostflame.hpp"
+
+#include <math.h>
+
+#include "audio/sound_manager.hpp"
+#include "math/random_generator.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object/sprite_particle.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
+#include "util/reader.hpp"
+
+Ghostflame::Ghostflame(const Reader& reader) :
+  BadGuy(reader, "images/creatures/flame/ghostflame.sprite", LAYER_FLOATINGOBJECTS), 
+  angle(0), 
+  radius(100), 
+  speed(2),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
+{
+  reader.get("radius", radius);
+  reader.get("speed", speed);
+  bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
+                      start_position.y + sin(angle) * radius));
+  countMe = false;
+  //TODO: get unique death sound
+  sound_manager->preload("sounds/fizz.wav");
+  
+  set_colgroup_active(COLGROUP_TOUCHABLE);
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.21f, 0.00f, 0.21f));
+  
+}
+
+void
+Ghostflame::active_update(float elapsed_time)
+{
+  angle = fmodf(angle + elapsed_time * speed, (float) (2*M_PI));
+  Vector newpos(start_position.x + cos(angle) * radius,
+                start_position.y + sin(angle) * radius);
+  movement = newpos - get_pos();
+  
+}
+
+void
+Ghostflame::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.blue + light.red < 2.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    sprite->draw(context, get_pos(), layer);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+
+void
+Ghostflame::kill_fall()
+{
+}
+
+/* EOF */
diff --git a/src/badguy/ghostflame.hpp b/src/badguy/ghostflame.hpp
new file mode 100644 (file)
index 0000000..572e976
--- /dev/null
@@ -0,0 +1,43 @@
+//  SuperTux badguy - Ghostflame a flame-like enemy that cannot be killed
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_BADGUY_GHOSTFLAME_HPP
+#define HEADER_SUPERTUX_BADGUY_GHOSTFLAME_HPP
+
+#include "badguy/badguy.hpp"
+
+class Ghostflame : public BadGuy
+{
+public:
+  Ghostflame(const Reader& reader);
+  Ghostflame(const Ghostflame& ghostflame);
+
+  void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
+  void kill_fall();
+
+private:
+  float angle;
+  float radius;
+  float speed;
+  Color light;
+  SpritePtr lightsprite;
+
+};
+
+#endif
+
+/* EOF */
diff --git a/src/badguy/iceflame.cpp b/src/badguy/iceflame.cpp
new file mode 100644 (file)
index 0000000..1ff3ea7
--- /dev/null
@@ -0,0 +1,110 @@
+//  SuperTux badguy - Iceflame a flame-like enemy that can be killed with fireballs
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "badguy/iceflame.hpp"
+
+#include <math.h>
+
+#include "audio/sound_manager.hpp"
+#include "math/random_generator.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object/sprite_particle.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
+#include "util/reader.hpp"
+
+Iceflame::Iceflame(const Reader& reader) :
+  BadGuy(reader, "images/creatures/flame/iceflame.sprite", LAYER_FLOATINGOBJECTS), 
+  angle(0), 
+  radius(100), 
+  speed(2),
+  fading(false),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
+{
+  reader.get("radius", radius);
+  reader.get("speed", speed);
+  bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
+                      start_position.y + sin(angle) * radius));
+  countMe = false;
+  //TODO: get unique death sound
+  sound_manager->preload("sounds/fizz.wav");
+  
+  set_colgroup_active(COLGROUP_TOUCHABLE);
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.00f, 0.13f, 0.18f));
+  
+}
+
+void
+Iceflame::active_update(float elapsed_time)
+{
+  angle = fmodf(angle + elapsed_time * speed, (float) (2*M_PI));
+  Vector newpos(start_position.x + cos(angle) * radius,
+                start_position.y + sin(angle) * radius);
+  movement = newpos - get_pos();
+  
+  if(fading)
+    if (sprite->animation_done()) remove_me();
+}
+
+void
+Iceflame::draw(DrawingContext& context)
+{
+  context.push_target();
+  //Rotate the Sprite (3 rotations per revolution)
+  sprite->set_angle(angle * 360.0f / (2*M_PI) * 3);
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.blue + light.green < 2.0){
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+  }
+  context.pop_target();
+}
+
+
+void
+Iceflame::kill_fall()
+{
+}
+
+void
+Iceflame::ignite()
+{
+  sound_manager->play("sounds/fizz.wav", get_pos());
+  sprite->set_action("fade", 1);
+  Vector ppos = bbox.get_middle();
+  Vector pspeed = Vector(0, -150);
+  Vector paccel = Vector(0,0);
+  Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
+  fading = true;
+  
+  // start dead-script
+  run_dead_script();
+}
+
+bool
+Iceflame::is_flammable() const
+{
+  return true;
+}
+
+/* EOF */
diff --git a/src/badguy/iceflame.hpp b/src/badguy/iceflame.hpp
new file mode 100644 (file)
index 0000000..9f1d8bc
--- /dev/null
@@ -0,0 +1,47 @@
+//  SuperTux badguy - Iceflame a flame-like enemy that can be killed with fireballs
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_BADGUY_ICEFLAME_HPP
+#define HEADER_SUPERTUX_BADGUY_ICEFLAME_HPP
+
+#include "badguy/badguy.hpp"
+
+class Iceflame : public BadGuy
+{
+public:
+  Iceflame(const Reader& reader);
+  Iceflame(const Iceflame& iceflame);
+
+  void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
+  void kill_fall();
+
+  void ignite();
+  bool is_flammable() const;
+
+private:
+  float angle;
+  float radius;
+  float speed;
+  bool fading;
+  Color light;
+  SpritePtr lightsprite;
+
+};
+
+#endif
+
+/* EOF */
index 6b6e81e..c1c7742 100644 (file)
@@ -22,6 +22,7 @@
 #include "object/camera.hpp"
 #include "object/player.hpp"
 #include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
 #include "util/reader.hpp"
@@ -39,12 +40,17 @@ Kugelblitz::Kugelblitz(const Reader& reader) :
   movement_timer(),
   lifetime(),
   direction(),
-  state()
+  state(),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite"))
 {
   reader.get("x", start_position.x);
   sprite->set_action("falling");
   physic.enable_gravity(false);
   countMe = false;
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.2f, 0.1f, 0.0f));  
 }
 
 void
@@ -150,6 +156,22 @@ Kugelblitz::active_update(float elapsed_time)
 }
 
 void
+Kugelblitz::draw(DrawingContext& context)
+{
+  sprite->draw(context, get_pos(), layer);
+  
+  //Only draw light in dark areas
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.red + light.green < 2.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    sprite->draw(context, get_pos(), layer);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+void
 Kugelblitz::kill_fall()
 {
 }
index 32c479d..95d402c 100644 (file)
@@ -32,6 +32,8 @@ public:
   void active_update(float);
   void kill_fall();
   void explode();
+  
+  virtual void draw(DrawingContext& context);
 
 private:
   void try_activate();
@@ -45,6 +47,8 @@ private:
   Timer lifetime;
   int direction;
   State state;
+  Color light;
+  SpritePtr lightsprite;
 };
 
 #endif
diff --git a/src/badguy/livefire.cpp b/src/badguy/livefire.cpp
new file mode 100644 (file)
index 0000000..955fad0
--- /dev/null
@@ -0,0 +1,182 @@
+//  SuperTux badguy - walking flame that glows
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "badguy/livefire.hpp"
+
+#include "audio/sound_manager.hpp"
+#include "object/player.hpp"
+#include "object/sprite_particle.hpp"
+#include "sprite/sprite.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
+
+static const float WALKSPEED = 80;
+static const float MAXDROPHEIGHT = 20;
+
+LiveFire::LiveFire(const Reader& reader) :
+  WalkingBadguy(reader, "images/creatures/livefire/livefire.sprite", "left", "right"),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-medium.sprite")),
+  state(STATE_WALKING)  
+{
+  walk_speed = WALKSPEED;
+  max_drop_height = MAXDROPHEIGHT;
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(1.0f, 0.9f, 0.8f));
+}
+
+void
+LiveFire::collision_solid(const CollisionHit& hit)
+{
+  if(state != STATE_WALKING) {
+    BadGuy::collision_solid(hit);
+    return;
+  }
+  WalkingBadguy::collision_solid(hit);
+}
+
+HitResponse
+LiveFire::collision_badguy(BadGuy& badguy, const CollisionHit& hit)
+{
+  if(state != STATE_WALKING) {
+    return BadGuy::collision_badguy(badguy, hit);
+  }
+  return WalkingBadguy::collision_badguy(badguy, hit);
+}
+
+void
+LiveFire::active_update(float elapsed_time) {
+
+  if(state == STATE_WALKING) {
+    WalkingBadguy::active_update(elapsed_time);
+    return;
+  }
+
+  if(state == STATE_SLEEPING) {
+
+    Player* player = this->get_nearest_player();
+    if (player) {
+      Rectf mb = this->get_bbox();
+      Rectf pb = player->get_bbox();
+
+      bool inReach_left = (pb.p2.x >= mb.p2.x-((dir == LEFT) ? 256 : 0));
+      bool inReach_right = (pb.p1.x <= mb.p1.x+((dir == RIGHT) ? 256 : 0));
+      bool inReach_top = (pb.p2.y >= mb.p1.y);
+      bool inReach_bottom = (pb.p1.y <= mb.p2.y);
+
+      if (inReach_left && inReach_right && inReach_top && inReach_bottom) {
+        // wake up
+        sprite->set_action(dir == LEFT ? "waking-left" : "waking-right", 1);
+        state = STATE_WAKING;
+      }
+    }
+
+    BadGuy::active_update(elapsed_time);
+  }
+
+  if(state == STATE_WAKING) {
+    if(sprite->animation_done()) {
+      // start walking
+      state = STATE_WALKING;
+      WalkingBadguy::initialize();
+    }
+
+    BadGuy::active_update(elapsed_time);
+  }
+}
+
+void
+LiveFire::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light
+  context.push_target();
+  context.set_target(DrawingContext::LIGHTMAP);
+  lightsprite->draw(context, get_bbox().get_middle(), 0);
+  context.pop_target();
+}
+
+void
+LiveFire::freeze()
+{
+  // attempting to freeze a flame causes it to go out
+  kill_fall();
+}
+
+bool
+LiveFire::is_freezable() const
+{
+  return true;
+}
+
+bool
+LiveFire::is_flammable() const
+{
+  return false;
+}
+
+void
+LiveFire::kill_fall()
+{
+  //TODO: get unique sound for ice-fire encounters
+  sound_manager->play("sounds/fall.wav", get_pos());
+  // throw a puff of smoke
+  Vector ppos = bbox.get_middle();
+  Vector pspeed = Vector(0, -150);
+  Vector paccel = Vector(0,0);
+  Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
+  // extinguish the flame
+  sprite->set_action(dir == LEFT ? "extinguish-left" : "extinguish-right");
+  physic.set_velocity_y(0);
+  physic.set_acceleration_y(0);
+  physic.enable_gravity(false);
+  set_state(STATE_SQUISHED); // used to nullify any threat and remove
+
+  // start dead-script
+  run_dead_script();
+}
+
+/* The following defines a sleeping version */
+
+LiveFireAsleep::LiveFireAsleep(const Reader& reader) :
+  LiveFire(reader)
+{
+  state = STATE_SLEEPING;
+}
+
+void
+LiveFireAsleep::initialize()
+{
+  physic.set_velocity_x(0);
+  sprite->set_action(dir == LEFT ? "sleeping-left" : "sleeping-right");
+}
+
+/* The following defines a dormant version that never wakes */
+LiveFireDormant::LiveFireDormant(const Reader& reader) :
+  LiveFire(reader)
+{
+  walk_speed = 0;
+  state = STATE_DORMANT;
+}
+
+void
+LiveFireDormant::initialize()
+{
+  physic.set_velocity_x(0);
+  sprite->set_action(dir == LEFT ? "sleeping-left" : "sleeping-right");
+}
+
+/* EOF */
diff --git a/src/badguy/livefire.hpp b/src/badguy/livefire.hpp
new file mode 100644 (file)
index 0000000..ff0db66
--- /dev/null
@@ -0,0 +1,69 @@
+//  SuperTux badguy - walking flame that glows
+//  Copyright (C) 2013 LMH <lmh.0013@gmail.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_BADGUY_LiveFire_HPP
+#define HEADER_SUPERTUX_BADGUY_LiveFire_HPP
+
+#include "badguy/walking_badguy.hpp"
+
+class LiveFire : public WalkingBadguy
+{
+public:
+  LiveFire(const Reader& reader);
+
+  void collision_solid(const CollisionHit& hit);
+  HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+  void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
+
+  void freeze();
+  bool is_freezable() const;
+  bool is_flammable() const;
+
+  virtual void kill_fall();
+
+private:
+  SpritePtr lightsprite;
+
+protected:
+  enum SState {
+    STATE_SLEEPING,
+    STATE_WAKING,
+    STATE_WALKING,
+    STATE_DORMANT
+  };
+  SState state;
+};
+
+class LiveFireAsleep : public LiveFire
+{
+public:
+  LiveFireAsleep(const Reader& reader);
+
+  void initialize();
+};
+
+class LiveFireDormant : public LiveFire
+{
+public:
+  LiveFireDormant(const Reader& reader);
+  
+  void initialize();
+};
+
+#endif
+
+/* EOF */
index 7fb4082..8e582a9 100644 (file)
@@ -23,6 +23,7 @@
 #include "object/player.hpp"
 #include "scripting/squirrel_util.hpp"
 #include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "supertux/game_session.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
@@ -44,7 +45,8 @@ WillOWisp::WillOWisp(const Reader& reader) :
   walker(),
   flyspeed(),
   track_range(),
-  vanish_range()
+  vanish_range(),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   bool running = false;
   flyspeed     = FLYSPEED;
@@ -73,6 +75,9 @@ WillOWisp::WillOWisp(const Reader& reader) :
   sound_manager->preload(SOUNDFILE);
   sound_manager->preload("sounds/warp.wav");
 
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.0f, 0.2f, 0.0f));
+
   sprite->set_action("idle");
 }
 
@@ -85,6 +90,7 @@ WillOWisp::draw(DrawingContext& context)
   context.set_target(DrawingContext::LIGHTMAP);
 
   sprite->draw(context, get_pos(), layer);
+  lightsprite->draw(context, get_bbox().get_middle(), 0);
 
   context.pop_target();
 }
index 19e4bb1..42ad8fc 100644 (file)
@@ -81,6 +81,7 @@ private:
   float flyspeed;
   float track_range;
   float vanish_range;
+  SpritePtr lightsprite;
 };
 
 #endif
index a4da53a..659267c 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include "math/random_generator.hpp"
 #include "object/bullet.hpp"
 #include "object/camera.hpp"
+#include "sprite/sprite.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/globals.hpp"
 #include "supertux/sector.hpp"
@@ -29,6 +31,8 @@ Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) :
   physic(),
   life_count(3), 
   sprite(),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")),
   type(type)
 {
   float speed = dir == RIGHT ? BULLET_XM : -BULLET_XM;
@@ -36,7 +40,9 @@ Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type) :
 
   if(type == FIRE_BONUS) {
     sprite = sprite_manager->create("images/objects/bullets/firebullet.sprite");
-  } else if(type == ICE_BONUS) {
+    lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+    lightsprite->set_color(Color(0.3f, 0.1f, 0.0f));
+ } else if(type == ICE_BONUS) {
     life_count = 10;
     sprite = sprite_manager->create("images/objects/bullets/icebullet.sprite");
   } else {
@@ -56,6 +62,11 @@ Bullet::~Bullet()
 void
 Bullet::update(float elapsed_time)
 {
+  // cause fireball color to flicker randomly
+  if (gameRandom.rand(5) != 0) {
+    lightsprite->set_color(Color(0.3f + gameRandom.rand(10)/100.0f, 0.1f + gameRandom.rand(20)/100.0f, gameRandom.rand(10)/100.0f));
+  } else
+    lightsprite->set_color(Color(0.3f, 0.1f, 0.0f));
   // remove bullet when it's offscreen
   float scroll_x =
     Sector::current()->camera->get_translation().x;
@@ -76,7 +87,19 @@ Bullet::update(float elapsed_time)
 void
 Bullet::draw(DrawingContext& context)
 {
+  //Draw the Sprite.
   sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if fire and dark
+  if(type == FIRE_BONUS){
+    context.get_light( get_bbox().get_middle(), &light );
+    if (light.red + light.green < 2.0){
+      context.push_target();
+      context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, get_pos(), LAYER_OBJECTS);
+      lightsprite->draw(context, get_bbox().get_middle(), 0);
+      context.pop_target();
+    }
+  }
 }
 
 void
index 90977ea..82ea841 100644 (file)
@@ -49,6 +49,8 @@ private:
   Physic physic;
   int life_count;
   SpritePtr sprite;
+  Color light;
+  SpritePtr lightsprite;
   BonusType type;
 };
 
index fe140f2..10c549d 100644 (file)
 #include "util/reader.hpp"
 
 Candle::Candle(const Reader& lisp)
-  : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true),
-    candle_light_1(Surface::create("images/objects/candle/candle-light-1.png")),
-    candle_light_2(Surface::create("images/objects/candle/candle-light-2.png"))
+  : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), 
+    burning(true), 
+    flicker(true),
+    lightcolor(1.0f, 1.0f, 1.0f),
+    candle_light_1(sprite_manager->create("images/objects/candle/candle-light-1.sprite")),
+    candle_light_2(sprite_manager->create("images/objects/candle/candle-light-2.sprite"))
 {
   lisp.get("name", name);
   lisp.get("burning", burning);
-
+  lisp.get("flicker", flicker);
+  //get color from lisp
+  std::vector<float> vColor;
+  lisp.get("color", vColor);
+  //change the light color if defined
+  if (vColor.size() >= 3) {
+    lightcolor = Color(vColor);
+    candle_light_1->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+    candle_light_2->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+    candle_light_1->set_color(lightcolor);
+    candle_light_2->set_color(lightcolor);
+    //the following allows the original candle appearance to be preserved
+    candle_light_1->set_action("white");
+    candle_light_2->set_action("white");
+  }
+    
   if (burning) {
     sprite->set_action("on");
   } else {
@@ -47,14 +65,16 @@ Candle::draw(DrawingContext& context)
 
   // draw on lightmap
   if (burning) {
-    Vector pos = get_pos() + (bbox.get_size() - candle_light_1->get_size()) / 2;
+    //Vector pos = get_pos() + (bbox.get_size() - candle_light_1->get_size()) / 2;
     context.push_target();
     context.set_target(DrawingContext::LIGHTMAP);
     // draw approx. 1 in 10 frames darker. Makes the candle flicker
-    if (gameRandom.rand(10) != 0) {
-      context.draw_surface(candle_light_1, pos, layer);
+    if (gameRandom.rand(10) != 0 || !flicker) {
+      //context.draw_surface(candle_light_1, pos, layer);
+      candle_light_1->draw(context, get_bbox().get_middle(), 0);
     } else {
-      context.draw_surface(candle_light_2, pos, layer);
+      //context.draw_surface(candle_light_2, pos, layer);
+      candle_light_2->draw(context, get_bbox().get_middle(), 0);
     }
     context.pop_target();
   }
@@ -103,11 +123,11 @@ Candle::set_burning(bool burning)
   this->burning = burning;
   if (burning) {
     sprite->set_action("on");
-    puff_smoke();
   } else {
     sprite->set_action("off");
-    puff_smoke();
   }
+  //puff smoke for flickering light sources only
+  if (flicker) puff_smoke();
 }
 
 /* EOF */
index 4b7146c..4ea74ba 100644 (file)
@@ -48,8 +48,10 @@ public:
 
 private:
   bool burning; /**< true if candle is currently lighted */
-  SurfacePtr candle_light_1; /**< drawn to lightmap */
-  SurfacePtr candle_light_2; /**< drawn to lightmap (alternative image) */
+  bool flicker; /**< true if candle light is to flicker */
+  Color lightcolor; /**< determines color or light given off */
+  SpritePtr candle_light_1; /**< drawn to lightmap */
+  SpritePtr candle_light_2; /**< drawn to lightmap (alternative image) */
 
 };
 
index d9e806c..3af1c15 100644 (file)
@@ -22,6 +22,8 @@
 #include "math/random_generator.hpp"
 #include "object/player.hpp"
 #include "object/sprite_particle.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
 
@@ -31,19 +33,27 @@ Explosion::Explosion(const Vector& pos) :
   MovingSprite(pos, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_MOVING),
   hurt(true),
   push(false),
-  state(STATE_WAITING)
+  state(STATE_WAITING),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-large.sprite"))
 {
   sound_manager->preload("sounds/explosion.wav");
   set_pos(get_pos() - (get_bbox().get_middle() - get_pos()));
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.6f, 0.6f, 0.6f));
 }
 
 Explosion::Explosion(const Reader& reader) :
   MovingSprite(reader, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_MOVING),
   hurt(true),
   push(false),
-  state(STATE_WAITING)
+  state(STATE_WAITING),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-large.sprite"))
 {
   sound_manager->preload("sounds/explosion.wav");
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.6f, 0.6f, 0.6f));
 }
 
 void
@@ -123,6 +133,21 @@ Explosion::update(float )
   }
 }
 
+void
+Explosion::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS+40);
+  //Explosions produce light (if ambient light is not maxed)
+  context.get_light( get_bbox().get_middle(), &light);
+  if (light.red + light.green + light.blue < 3.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
 HitResponse
 Explosion::collision(GameObject& other, const CollisionHit& )
 {
index 869b982..3e46ef4 100644 (file)
@@ -32,6 +32,7 @@ public:
   Explosion(const Reader& reader);
 
   void update(float elapsed_time);
+  void draw(DrawingContext& context);
   HitResponse collision(GameObject& other, const CollisionHit& hit);
 
   bool hurts (void) const
@@ -68,6 +69,8 @@ private:
   bool hurt;
   bool push;
   State state;
+  Color light;
+  SpritePtr lightsprite;
 
 };
 
index eb54f9c..f3bcdca 100644 (file)
 #include "audio/sound_manager.hpp"
 #include "object/flower.hpp"
 #include "object/player.hpp"
+#include "sprite/sprite.hpp"
 #include "sprite/sprite_manager.hpp"
 
 Flower::Flower(BonusType _type) :
   type(_type),
   sprite(),
-  drawing_effect(NO_EFFECT)
+  drawing_effect(NO_EFFECT),
+  light(1.0f,1.0f,1.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   bbox.set_size(32, 32);
-
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  
   if(type == FIRE_BONUS) {
     sprite = sprite_manager->create("images/powerups/fireflower/fireflower.sprite");
     sound_manager->preload("sounds/fire-flower.wav");
+    lightsprite->set_color(Color(0.3f, 0.0f, 0.0f));
   }
   else if(type == ICE_BONUS) {
     sprite = sprite_manager->create("images/powerups/iceflower/iceflower.sprite");
     sound_manager->preload("sounds/fire-flower.wav");
+    lightsprite->set_color(Color(0.0f, 0.1f, 0.2f));
   } else {
     assert(false);
   }
@@ -52,7 +58,16 @@ Flower::update(float )
 void
 Flower::draw(DrawingContext& context)
 {
+  //Draw the Sprite.
   sprite->draw(context, get_pos(), LAYER_OBJECTS, drawing_effect);
+  //Draw the light when dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.red + light.green + light.blue < 3.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
 }
 
 HitResponse
index ec72a64..2bba798 100644 (file)
@@ -39,7 +39,9 @@ private:
 private:
   Flower(const Flower&);
   Flower& operator=(const Flower&);
-
+  Color light;
+  SpritePtr lightsprite;
+  
   friend class FlipLevelTransformer;
 };
 
index 4990cf0..19be535 100644 (file)
 #include "audio/sound_manager.hpp"
 #include "object/growup.hpp"
 #include "object/player.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 
 GrowUp::GrowUp(Direction direction) :
   MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING),
-  physic()
+  physic(),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   physic.enable_gravity(true);
   physic.set_velocity_x((direction == LEFT)?-100:100);
   sound_manager->preload("sounds/grow.ogg");
+  //set light for glow effect
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.2f, 0.2f, 0.0f));
 }
 
 void
@@ -34,6 +41,20 @@ GrowUp::update(float elapsed_time)
 }
 
 void
+GrowUp::draw(DrawingContext& context){
+  //Draw the Sprite.
+  MovingSprite::draw(context);
+  //Draw the light when dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.red + light.green < 2.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+void
 GrowUp::collision_solid(const CollisionHit& hit)
 {
   if(hit.top)
index e10266c..f1427c0 100644 (file)
@@ -27,12 +27,15 @@ public:
   GrowUp(Direction direction = RIGHT);
 
   virtual void update(float elapsed_time);
+  virtual void draw(DrawingContext& context);
   virtual void collision_solid(const CollisionHit& hit);
   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
   void do_jump();
 
 private:
   Physic physic;
+  Color light;
+  SpritePtr lightsprite;
 };
 
 #endif
index eb9cd5c..a70560f 100644 (file)
@@ -19,6 +19,8 @@
 #include "object/powerup.hpp"
 #include "supertux/object_factory.hpp"
 #include "supertux/sector.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "util/reader.hpp"
 
 #include <sstream>
@@ -27,7 +29,9 @@ PowerUp::PowerUp(const Reader& lisp) :
   MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING),
   physic(),
   script(),
-  no_physics()
+  no_physics(),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   lisp.get("script", script);
   no_physics = false;
@@ -35,6 +39,19 @@ PowerUp::PowerUp(const Reader& lisp) :
   physic.enable_gravity(true);
   sound_manager->preload("sounds/grow.ogg");
   sound_manager->preload("sounds/fire-flower.wav");
+  //set default light for glow effect for standard sprites
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.0f, 0.0f, 0.0f));
+  if (sprite_name == "images/powerups/egg/egg.sprite") {
+    lightsprite->set_color(Color(0.2f, 0.2f, 0.0f));
+  } else if (sprite_name == "images/powerups/fireflower/fireflower.sprite") {
+    lightsprite->set_color(Color(0.3f, 0.0f, 0.0f));
+  } else if (sprite_name == "images/powerups/iceflower/iceflower.sprite") {
+    lightsprite->set_color(Color(0.0f, 0.1f, 0.2f));
+  } else if (sprite_name == "images/powerups/star/star.sprite") {
+    lightsprite->set_color(Color(0.4f, 0.4f, 0.4f));
+  }
+
 }
 
 void
@@ -71,6 +88,10 @@ PowerUp::collision(GameObject& other, const CollisionHit&)
     if(!player->add_bonus(FIRE_BONUS, true))
       return FORCE_MOVE;
     sound_manager->play("sounds/fire-flower.wav");
+  } else if (sprite_name == "images/powerups/iceflower/iceflower.sprite") {
+    if(!player->add_bonus(ICE_BONUS, true))
+      return FORCE_MOVE;
+    sound_manager->play("sounds/fire-flower.wav");
   } else if (sprite_name == "images/powerups/star/star.sprite") {
     player->make_invincible();
   } else if (sprite_name == "images/powerups/1up/1up.sprite") {
@@ -88,4 +109,21 @@ PowerUp::update(float elapsed_time)
     movement = physic.get_movement(elapsed_time);
 }
 
+void
+PowerUp::draw(DrawingContext& context){
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), layer);
+  //Draw light when dark for defaults
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.red + light.green + light.blue < 3.0){
+    //Stars are brighter
+    if (sprite_name == "images/powerups/star/star.sprite") {
+      sprite->draw(context, get_pos(), layer);
+    }
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
 /* EOF */
index bca1be0..a1d814b 100644 (file)
@@ -25,6 +25,7 @@ public:
   PowerUp(const Reader& lisp);
 
   virtual void update(float elapsed_time);
+  virtual void draw(DrawingContext& context);
   virtual void collision_solid(const CollisionHit& hit);
   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
 
@@ -32,6 +33,8 @@ private:
   Physic physic;
   std::string script;
   bool no_physics;
+  Color light;
+  SpritePtr lightsprite;
 };
 
 #endif
index 514527e..71fa611 100644 (file)
@@ -16,6 +16,8 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "object/camera.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 #include "object/sprite_particle.hpp"
 #include "supertux/globals.hpp"
 #include "supertux/sector.hpp"
@@ -29,7 +31,10 @@ SpriteParticle::SpriteParticle(std::string sprite_name, std::string action,
   position(position), 
   velocity(velocity), 
   acceleration(acceleration), 
-  drawing_layer(drawing_layer)
+  drawing_layer(drawing_layer),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
+  glow(false)
 {
   sprite = sprite_manager->create(sprite_name);
   if (!sprite.get()) throw std::runtime_error("Could not load sprite "+sprite_name);
@@ -37,6 +42,9 @@ SpriteParticle::SpriteParticle(std::string sprite_name, std::string action,
   sprite->set_animation_loops(1); //TODO: this is necessary because set_action will not set "loops" when "action" is the default action
 
   this->position -= get_anchor_pos(sprite->get_current_hitbox(), anchor);
+
+  if(sprite_name=="images/objects/particles/sparkle.sprite")
+    glow = true;
 }
 
 SpriteParticle::~SpriteParticle()
@@ -77,6 +85,19 @@ void
 SpriteParticle::draw(DrawingContext& context)
 {
   sprite->draw(context, position, drawing_layer);
+
+  //Sparkles glow in the dark
+  if(glow){
+    context.get_light(position, &light );
+    if (light.red + light.green + light.blue < 3.0){
+      context.push_target();
+      context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, position, drawing_layer);
+      lightsprite->draw(context, position + Vector(12,12), 0);
+      context.pop_target();
+    }
+  }
+
 }
 
 /* EOF */
index 6a32e05..4d607a6 100644 (file)
@@ -40,6 +40,9 @@ private:
   Vector velocity;
   Vector acceleration;
   int drawing_layer;
+  Color light;
+  SpritePtr lightsprite;
+  bool glow;
 
 private:
   SpriteParticle(const SpriteParticle&);
index f421d43..2d3cd03 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "object/player.hpp"
 #include "object/star.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
 
 static const float INITIALJUMP = -400;
 static const float STAR_SPEED = 150;
@@ -23,9 +25,14 @@ static const float JUMPSTAR_SPEED = -300;
 
 Star::Star(const Vector& pos, Direction direction) :
   MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING),
-  physic()
+  physic(),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   physic.set_velocity((direction == LEFT) ? -STAR_SPEED : STAR_SPEED, INITIALJUMP);
+  //set light for glow effect
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.4f, 0.4f, 0.4f));
 }
 
 void
@@ -35,6 +42,21 @@ Star::update(float elapsed_time)
 }
 
 void
+Star::draw(DrawingContext& context){
+  //Draw the Sprite.
+  MovingSprite::draw(context);
+  //Draw the light when dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.red + light.green + light.blue < 3.0){
+    MovingSprite::draw(context);
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+void
 Star::collision_solid(const CollisionHit& hit)
 {
   if(hit.bottom) {
index f719ae1..5e18404 100644 (file)
@@ -25,11 +25,14 @@ public:
   Star(const Vector& pos, Direction direction = RIGHT);
 
   virtual void update(float elapsed_time);
+  virtual void draw(DrawingContext& context);
   virtual void collision_solid(const CollisionHit& hit);
   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
 
 private:
   Physic physic;
+  Color light;
+  SpritePtr lightsprite;
 };
 
 #endif
index 78644d6..693930c 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "object/weak_block.hpp"
 
+#include "math/random_generator.hpp"
 #include "object/bullet.hpp"
 #include "object/explosion.hpp"
 #include "supertux/object_factory.hpp"
@@ -29,7 +30,9 @@
 
 WeakBlock::WeakBlock(const Reader& lisp)
 : MovingSprite(lisp, "images/objects/weak_block/strawbox.sprite", LAYER_TILES, COLGROUP_STATIC), state(STATE_NORMAL),
-linked(true)
+  linked(true),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
 {
   sprite->set_action("normal");
   //Check if this weakblock destroys adjacent weakblocks
@@ -40,6 +43,8 @@ linked(true)
       sprite->set_action("normal");
     }
   }
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.3f, 0.2f, 0.1f));
 }
 
 HitResponse
@@ -107,11 +112,22 @@ WeakBlock::update(float )
         break;
                                
       case STATE_BURNING:
+        // cause burn light to flicker randomly
+        if (linked) {
+          if(gameRandom.rand(10) >= 7) {
+            lightsprite->set_color(Color(0.2f + gameRandom.rand(20)/100.0f, 0.1f + gameRandom.rand(20)/100.0f, 0.1f));
+          } else
+            lightsprite->set_color(Color(0.3f, 0.2f, 0.1f));
+        }
+      
         if (sprite->animation_done()) {
           state = STATE_DISINTEGRATING;
           sprite->set_action("disintegrating", 1);
           spreadHit();
           set_group(COLGROUP_DISABLED);
+          lightsprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite");
+          lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+          lightsprite->set_color(Color(0.3f, 0.2f, 0.1f));
         }
         break;
                                
@@ -126,6 +142,24 @@ WeakBlock::update(float )
 }
 
 void
+WeakBlock::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if burning and dark
+  if(linked && (state != STATE_NORMAL)){
+    context.get_light( get_bbox().get_middle(), &light );
+    if (light.red + light.green + light.blue < 3.0){
+      context.push_target();
+      context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, get_pos(), LAYER_OBJECTS);
+      lightsprite->draw(context, get_bbox().get_middle(), 0);
+      context.pop_target();
+    }
+  }
+}
+                                 
+void
 WeakBlock::startBurning()
 {
   if (state != STATE_NORMAL) return;
index 133b713..ad25602 100644 (file)
@@ -33,6 +33,7 @@ public:
 
   HitResponse collision(GameObject& other, const CollisionHit& hit);
   void update(float elapsed_time);
+  void draw(DrawingContext& context);
        
 protected:
   /**
@@ -56,6 +57,9 @@ private:
   bool linked;
   virtual HitResponse collision_bullet(Bullet& bullet, const CollisionHit& hit);
 
+  Color light;
+  SpritePtr lightsprite;
+
 };
 
 #endif
index d08e1f7..91afa92 100644 (file)
 #include "badguy/fish.hpp"
 #include "badguy/flame.hpp"
 #include "badguy/flyingsnowball.hpp"
+#include "badguy/ghostflame.hpp"
 #include "badguy/ghosttree.hpp"
 #include "badguy/goldbomb.hpp"
 #include "badguy/haywire.hpp"
+#include "badguy/iceflame.hpp"
 #include "badguy/igel.hpp"
 #include "badguy/jumpy.hpp"
 #include "badguy/kamikazesnowball.hpp"
 #include "badguy/kugelblitz.hpp"
+#include "badguy/livefire.hpp"
 #include "badguy/mole.hpp"
 #include "badguy/mole_rock.hpp"
 #include "badguy/mrbomb.hpp"
@@ -189,13 +192,18 @@ ObjectFactory::init_factories()
   add_factory<Fish>("fish");
   add_factory<Flame>("flame");
   add_factory<FlyingSnowBall>("flyingsnowball");
+  add_factory<Ghostflame>("ghostflame");
   add_factory<GhostTree>("ghosttree");
   add_factory<GoldBomb>("goldbomb");
   add_factory<Haywire>("haywire");
+  add_factory<Iceflame>("iceflame");
   add_factory<Igel>("igel");
   add_factory<Jumpy>("jumpy");
   add_factory<KamikazeSnowball>("kamikazesnowball");
   add_factory<Kugelblitz>("kugelblitz");
+  add_factory<LiveFire>("livefire");
+  add_factory<LiveFireAsleep>("livefire_asleep");
+  add_factory<LiveFireDormant>("livefire_dormant");
   add_factory<Mole>("mole");
   add_factory<MoleRock>("mole_rock");
   add_factory<MrBomb>("mrbomb");