- readded paralax tiles, not so sure why they disappeared in the first place
[supertux.git] / src / sector.cpp
index 9873100..a33ad64 100644 (file)
@@ -45,6 +45,7 @@
 #include "object/coin.h"
 #include "object/block.h"
 #include "object/invisible_block.h"
+#include "object/invisible_tile.h"
 #include "object/platform.h"
 #include "object/bullet.h"
 #include "badguy/jumpy.h"
@@ -55,6 +56,7 @@
 #include "badguy/mrbomb.h"
 #include "badguy/dispenser.h"
 #include "badguy/spike.h"
+#include "badguy/spiky.h"
 #include "badguy/nolok_01.h"
 #include "trigger/door.h"
 #include "trigger/sequence_trigger.h"
@@ -63,7 +65,7 @@
 Sector* Sector::_current = 0;
 
 Sector::Sector()
-  : gravity(10), player(0), solids(0), background(0), camera(0),
+  : gravity(10), player(0), solids(0), camera(0),
     currentmusic(LEVEL_MUSIC)
 {
   song_title = "Mortimers_chipdisko.mod";
@@ -93,8 +95,7 @@ GameObject*
 Sector::parse_object(const std::string& name, LispReader& reader)
 {
   if(name == "background") {
-    background = new Background(reader);
-    return background;
+    return new Background(reader);
   } else if(name == "camera") {
     Camera* camera = new Camera(this);
     camera->parse(reader);
@@ -131,6 +132,8 @@ Sector::parse_object(const std::string& name, LispReader& reader)
     return new Dispenser(reader);
   } else if(name == "spike") {
     return new Spike(reader);
+  } else if(name == "spiky") {
+    return new Spiky(reader);
   } else if(name == "nolok_01") {
     return new Nolok_01(reader);
   }
@@ -332,31 +335,34 @@ Sector::fix_old_tiles()
       const Tile* tile = solids->get_tile(x, y);
       Vector pos(x*32, y*32);
       
-      if(tile->id == 112) {
+      if(tile->getID() == 112) {
         add_object(new InvisibleBlock(pos));
         solids->change(x, y, 0);
-      } else if(tile->id == 295) {
+      } else if(tile->getID() == 1311) {
+        add_object(new InvisibleTile(pos));
+       solids->change(x, y, 0);
+      } else if(tile->getID() == 295) {
         add_object(new Spike(pos, Spike::NORTH));
         solids->change(x, y, 0);
-      } else if(tile->id == 296) {
+      } else if(tile->getID() == 296) {
         add_object(new Spike(pos, Spike::EAST));
         solids->change(x, y, 0);
-      } else if(tile->id == 297) {
+      } else if(tile->getID() == 297) {
         add_object(new Spike(pos, Spike::SOUTH));
         solids->change(x, y, 0);
-      } else if(tile->id == 298) {
+      } else if(tile->getID() == 298) {
         add_object(new Spike(pos, Spike::WEST));
         solids->change(x, y, 0);
-      } else if(tile->attributes & Tile::COIN) {
+      } else if(tile->getAttributes() & Tile::COIN) {
         add_object(new Coin(pos));
         solids->change(x, y, 0);
-      } else if(tile->attributes & Tile::FULLBOX) {
-        add_object(new BonusBlock(pos, tile->data));
+      } else if(tile->getAttributes() & Tile::FULLBOX) {
+        add_object(new BonusBlock(pos, tile->getData()));
         solids->change(x, y, 0);
-      } else if(tile->attributes & Tile::BRICK) {
-        add_object(new Brick(pos, tile->data));
+      } else if(tile->getAttributes() & Tile::BRICK) {
+        add_object(new Brick(pos, tile->getData()));
         solids->change(x, y, 0);
-      } else if(tile->attributes & Tile::GOAL) {
+      } else if(tile->getAttributes() & Tile::GOAL) {
         add_object(new SequenceTrigger(pos, "endsequence"));
         solids->change(x, y, 0);
       }
@@ -601,16 +607,16 @@ Sector::collision_tilemap(MovingObject* object, int depth)
       const Tile* tile = solids->get_tile(x, y);
       if(!tile)
         continue;
-      if(!(tile->attributes & Tile::SOLID))
+      if(!(tile->getAttributes() & Tile::SOLID))
         continue;
-      if((tile->attributes & Tile::UNISOLID) && object->movement.y < 0)
+      if((tile->getAttributes() & Tile::UNISOLID) && object->movement.y < 0)
         continue;
 
-      if(tile->attributes & Tile::SLOPE) { // slope tile
+      if(tile->getAttributes() & Tile::SLOPE) { // slope tile
         AATriangle triangle;
         Vector p1(x*32, y*32);
         Vector p2((x+1)*32, (y+1)*32);
-        triangle = AATriangle(p1, p2, tile->data);
+        triangle = AATriangle(p1, p2, tile->getData());
 
         if(Collision::rectangle_aatriangle(temphit, dest, object->movement,
               triangle)) {