Documenting more, cleaning variables. This code needs some serious
authorsaiam
Fri, 28 Nov 2008 22:26:23 +0000
changeset 128 890ac82cdcc0
parent 127 241830182118
child 129 b1ae79a2d2f0
Documenting more, cleaning variables. This code needs some serious
rewriting. (And we havent too many features either)
src/proto2/Physics.cc
src/proto2/Physics.hh
--- a/src/proto2/Physics.cc	Fri Nov 28 18:23:57 2008 +0000
+++ b/src/proto2/Physics.cc	Fri Nov 28 22:26:23 2008 +0000
@@ -35,8 +35,10 @@
     return tick_counter;
 }
 
-PhysicsObject::PhysicsObject (PhysicsWorld &world, float mass, Vector position, Vector velocity)
-    : world(world), mass(mass), position(position), velocity(velocity), inAir(true), facing(3) {
+PhysicsObject::PhysicsObject (PhysicsWorld &world, float mass, 
+                              Vector position, Vector velocity)
+    : world(world), mass(mass), position(position), 
+      velocity(velocity), facingRight(true), inAir(true) {
 
     world.addObject(this);
 }
@@ -372,9 +374,9 @@
     //Engine::log(DEBUG, "PhysicsObject.changeAim") << "Player aim: " << this->aim;
 }
 
-void PhysicsObject::setFacing(bool right) {
+void PhysicsObject::setFacing(bool facingRight) {
     //Engine::log(DEBUG, "PhysicsObject.setFacing") << "Facing: " << right;
-    this->facing = right;
+    this->facingRight = facingRight;
 }
 
 void PhysicsObject::updatePhysics (Vector position, Vector velocity, bool inAir) {
@@ -388,7 +390,7 @@
 }
 
 bool PhysicsObject::getFacing() {
-    return this->facing;
+    return this->facingRight;
 }
 
 float PhysicsObject::getAim() {
--- a/src/proto2/Physics.hh	Fri Nov 28 18:23:57 2008 +0000
+++ b/src/proto2/Physics.hh	Fri Nov 28 22:26:23 2008 +0000
@@ -93,7 +93,23 @@
      */
     TerrainType getType(Vector pos) const;
 
+    /**
+     * Remove ground from the terrain. Removes a circle with given
+     * radius.
+     *
+     * @param x center x coordinate
+     * @param y center y coordinate
+     * @param r circle radius
+     */
     void removeGround(int x, int y, float r);
+    
+    /**
+     * Remove ground from the terrain. Removes a circle with given
+     * radius.
+     *
+     * @param pos circle center
+     * @param r circle radius
+     */
     void removeGround(Vector pos, float r);
 };
 
@@ -104,11 +120,9 @@
     float mass;
     Vector position;
     Vector velocity;
-    // Whether the object (worms mainly) is in the air 
-    // or firmly on the ground. Affects to physics.
-    bool inAir;
-    float aim;
-    uint8_t facing;
+    float aim; // Aim direction (half circle)
+    bool facingRight; // Player facing
+    bool inAir; // Is the object "on the ground"
 
     // Shape of the object. We use a polygon with 4 edges
     // to make easy to draw with Clanlib. The coordinates