New bonus_block contnet: trampolines & rock
authorLMH <lmh.0013@gmail.com>
Thu, 29 Nov 2012 02:07:12 +0000 (16:07 -1000)
committerLMH <lmh.0013@gmail.com>
Fri, 7 Dec 2012 00:33:29 +0000 (14:33 -1000)
data/images/objects/bonus_block/bonus-porttramp.png [new file with mode: 0644]
data/images/objects/bonus_block/bonus-rock.png [new file with mode: 0644]
data/images/objects/bonus_block/bonus-tramp.png [new file with mode: 0644]
data/images/objects/bonus_block/light.xcf
data/images/objects/lightmap_light/bonusblock_light.png
data/images/tiles.strf
data/levels/test/bonusblock.stl
src/object/bonus_block.cpp
src/object/bonus_block.hpp
src/object/trampoline.cpp
src/object/trampoline.hpp

diff --git a/data/images/objects/bonus_block/bonus-porttramp.png b/data/images/objects/bonus_block/bonus-porttramp.png
new file mode 100644 (file)
index 0000000..5b502bb
Binary files /dev/null and b/data/images/objects/bonus_block/bonus-porttramp.png differ
diff --git a/data/images/objects/bonus_block/bonus-rock.png b/data/images/objects/bonus_block/bonus-rock.png
new file mode 100644 (file)
index 0000000..57a4baa
Binary files /dev/null and b/data/images/objects/bonus_block/bonus-rock.png differ
diff --git a/data/images/objects/bonus_block/bonus-tramp.png b/data/images/objects/bonus_block/bonus-tramp.png
new file mode 100644 (file)
index 0000000..b71021e
Binary files /dev/null and b/data/images/objects/bonus_block/bonus-tramp.png differ
index 91e5440..59a63b3 100644 (file)
Binary files a/data/images/objects/bonus_block/light.xcf and b/data/images/objects/bonus_block/light.xcf differ
index e498abd..d158c18 100644 (file)
Binary files a/data/images/objects/lightmap_light/bonusblock_light.png and b/data/images/objects/lightmap_light/bonusblock_light.png differ
index afc788f..c74c5e5 100644 (file)
 ;;    src/tile.cpp, unisolid is 3 not 2
 (supertux-tiles
   (tile
+    (id 2946)
+    (images
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-4.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+    )
+    (solid #t)
+    (fullbox #t)
+    (next-tile 84)
+    (editor-images "objects/bonus_block/bonus-rock.png")
+    (data 9)
+    (fps 15)
+  )
+  
+  (tile
+    (id 2945)
+    (images
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-4.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+    )
+    (solid #t)
+    (fullbox #t)
+    (next-tile 84)
+    (editor-images "objects/bonus_block/bonus-porttramp.png")
+    (data 8)
+    (fps 15)
+  )
+  
+  (tile
+    (id 2944)
+    (images
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-4.png"
+      "objects/bonus_block/full-3.png"
+      "objects/bonus_block/full-2.png"
+      "objects/bonus_block/full-1.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+      "objects/bonus_block/full-0.png"
+    )
+    (solid #t)
+    (fullbox #t)
+    (next-tile 84)
+    (editor-images "objects/bonus_block/bonus-tramp.png")
+    (data 7)
+    (fps 15)
+  )
+  
+  (tile
     (id 2943)
     (images
       "objects/bonus_block/full-0.png"
   )
   (tilegroup
     (name "Block")
-    (tiles 27 28 29 47 48 50 49 211 77 51 52 212 78 62 61 213 44 83 84 102 140 103 104 105 112 128 1311 2153 2943)
+    (tiles 27 28 29 47 48 50 49 211 77 51 52 212 78 62 61 213 44 83 84 102 140 103 104 105 112 128 2943 2944 2945 2946 1311 2153)
   )
   (tilegroup
     (name "Background")
     (image "tiles/snow/slope-upper.png" )
   )
 
-;; next-id: 2944
+;; next-id: 2947
 )
index 4f953a0..a3b7b00 100755 (executable)
@@ -22,7 +22,7 @@
 0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       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
-0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       44      0       0       0       0       0       0       0       0       0       0       0             0       0       0       0       0       0       0       0       0       ;       224
+0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       44      0       0       0       0       0       0       0       0       0       0       0       44      0       0       0       0       0       0       0       0       0       ;       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       0       0       ;       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       0       0       ;       320
 0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       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       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       480
+0      0       0       0       2946    0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       480
 0      0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       ;       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       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       0       2943    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       2943    0       0       0       2944    2945    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       132     0       ;       704
 8      8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       8       48      8       ;       736
index 37ad895..4fa2704 100644 (file)
@@ -28,6 +28,7 @@
 #include "object/portable.hpp"
 #include "object/specialriser.hpp"
 #include "object/star.hpp"
+#include "object/trampoline.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/constants.hpp"
 #include "supertux/level.hpp"
@@ -41,7 +42,7 @@ BonusBlock::BonusBlock(const Vector& pos, int data) :
   contents(),
   object(0),
   hit_counter(1),
-  lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png"))
+  lightsprite()
 {
   bbox.set_pos(pos);
   sprite->set_action("normal");
@@ -51,7 +52,13 @@ BonusBlock::BonusBlock(const Vector& pos, int data) :
     case 3: contents = CONTENT_STAR; break;
     case 4: contents = CONTENT_1UP; break;
     case 5: contents = CONTENT_ICEGROW; break;
-    case 6: contents = CONTENT_LIGHT; sound_manager->preload("sounds/switch.ogg"); break;
+    case 6: contents = CONTENT_LIGHT; 
+      sound_manager->preload("sounds/switch.ogg"); 
+      lightsprite=Surface::create("/images/objects/lightmap_light/bonusblock_light.png");
+      break;
+    case 7: contents = CONTENT_TRAMPOLINE; break;
+    case 8: contents = CONTENT_PORTTRAMPOLINE; break;
+    case 9: contents = CONTENT_ROCK; break;
     default:
       log_warning << "Invalid box contents" << std::endl;
       contents = CONTENT_COIN;
@@ -64,7 +71,7 @@ BonusBlock::BonusBlock(const Reader& lisp) :
   contents(),
   object(0),
   hit_counter(1),
-  lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png"))
+  lightsprite()
 {
   Vector pos;
 
@@ -103,6 +110,12 @@ BonusBlock::BonusBlock(const Reader& lisp) :
       } else if(contentstring == "light") {
         contents = CONTENT_LIGHT;
         sound_manager->preload("sounds/switch.ogg");
+      } else if(contentstring == "trampoline") {
+        contents = CONTENT_TRAMPOLINE;
+      } else if(contentstring == "porttrampoline") {
+        contents = CONTENT_PORTTRAMPOLINE;
+      } else if(contentstring == "rock") {
+        contents = CONTENT_ROCK;
       } else {
         log_warning << "Invalid box contents '" << contentstring << "'" << std::endl;
       }
@@ -121,6 +134,8 @@ BonusBlock::BonusBlock(const Reader& lisp) :
 
   if(contents == CONTENT_CUSTOM && object == 0)
     throw std::runtime_error("Need to specify content object for custom block");
+  if(contents == CONTENT_LIGHT)
+    lightsprite = Surface::create("/images/objects/lightmap_light/bonusblock_light.png");
 
   bbox.set_pos(pos);
 }
@@ -257,6 +272,29 @@ BonusBlock::try_open(Player *player)
       else
         sprite->set_action("on");
       sound_manager->play("sounds/switch.ogg");
+      break;
+    }
+    case CONTENT_TRAMPOLINE:
+    {
+      SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), false));
+      sector->add_object(riser);
+      sound_manager->play("sounds/upgrade.wav");
+      break;
+    }
+    case CONTENT_PORTTRAMPOLINE:
+    {
+      SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), true));
+      sector->add_object(riser);
+      sound_manager->play("sounds/upgrade.wav");
+      break;
+    }
+    case CONTENT_ROCK:
+    {
+      SpecialRiser* riser = new SpecialRiser(get_pos(), 
+        new Rock(get_pos(), "images/objects/rock/rock.sprite"));
+      sector->add_object(riser);
+      sound_manager->play("sounds/upgrade.wav");
+      break;
     }
   }
 
index f993785..3038358 100644 (file)
@@ -38,7 +38,10 @@ public:
     CONTENT_1UP,
     CONTENT_CUSTOM,
     CONTENT_SCRIPT,
-    CONTENT_LIGHT
+    CONTENT_LIGHT,
+    CONTENT_TRAMPOLINE,
+    CONTENT_PORTTRAMPOLINE,
+    CONTENT_ROCK
   };
 
 protected:
index c93d349..199fe16 100644 (file)
@@ -49,6 +49,18 @@ Trampoline::Trampoline(const Reader& lisp) :
   }
 }
 
+Trampoline::Trampoline(const Vector& pos, bool port) : 
+  Rock(pos, "images/objects/trampoline/trampoline.sprite"),
+  portable(port)
+{
+  sound_manager->preload(TRAMPOLINE_SOUND);
+  if(!port) {
+    sprite_name = "images/objects/trampoline/trampoline_fix.sprite";
+    sprite = sprite_manager->create(sprite_name);
+    sprite->set_action("normal");
+  }
+}
+
 void
 Trampoline::update(float elapsed_time)
 {
index 27cea23..9f7fc77 100644 (file)
@@ -26,6 +26,7 @@ class Trampoline : public Rock
 {
 public:
   Trampoline(const Reader& reader);
+  Trampoline(const Vector& pos, bool port);
 
   HitResponse collision(GameObject& other, const CollisionHit& hit);
   void collision_solid(const CollisionHit& hit);