super metroid style camera
[supertux.git] / src / object / platform.cpp
index 333fd07..b017ca4 100644 (file)
@@ -35,7 +35,7 @@
 #include "scripting/squirrel_util.hpp"
 
 Platform::Platform(const lisp::Lisp& reader)
-       : MovingSprite(reader, Vector(0,0), LAYER_OBJECTS, COLGROUP_STATIC), name(""), speed(Vector(0,0))
+       : MovingSprite(reader, Vector(0,0), LAYER_OBJECTS, COLGROUP_STATIC), speed(Vector(0,0))
 {
   bool running = true;
   reader.get("name", name);
@@ -47,36 +47,20 @@ Platform::Platform(const lisp::Lisp& reader)
   path->read(*pathLisp);
   walker.reset(new PathWalker(path.get(), running));
   bbox.set_pos(path->get_base());
-  flags |= FLAG_SOLID;
 }
 
 Platform::Platform(const Platform& other)
-       : MovingSprite(other), ScriptInterface(other), name(other.name), speed(other.speed)
+       : MovingSprite(other), ScriptInterface(other), speed(other.speed)
 {
+  name = other.name;
   path.reset(new Path(*other.path));
   walker.reset(new PathWalker(*other.walker));
   walker->path = &*path;
 }
 
-//TODO: Squish Tux when standing between platform and solid tile/object
-//      Improve collision handling
-//      Move all MovingObjects lying on the platform instead of only the player
 HitResponse
-Platform::collision(GameObject& other, const CollisionHit& hit)
+Platform::collision(GameObject& , const CollisionHit& )
 {
-  if (typeid(other) == typeid(Player)) {
-    if (hit.normal.y >= 0.9) {
-      //Tux is standing on the platform
-      //Player* player = (Player*) &other;
-      //player->add_velocity(speed * 1.5);
-      return PASS_MOVEMENT;
-    }
-  }
-  if(other.get_flags() & FLAG_SOLID) {
-    //Collision with a solid tile
-    return ABORT_MOVE;
-  }
   return FORCE_MOVE;
 }
 
@@ -108,7 +92,7 @@ Platform::stop_moving()
 void
 Platform::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
-  if (name == "") return;
+  if (name.empty()) return;
   Scripting::Platform* interface = new Scripting::Platform(this);
   expose_object(vm, table_idx, interface, name, true);
 }
@@ -116,7 +100,7 @@ Platform::expose(HSQUIRRELVM vm, SQInteger table_idx)
 void
 Platform::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
 {
-  if (name == "") return;
+  if (name.empty()) return;
   Scripting::unexpose_object(vm, table_idx, name);
 }