src/proto2/Physics.cc
changeset 90 c1a072928790
parent 88 7431cd0cf900
child 91 0a6d675099dc
--- a/src/proto2/Physics.cc	Thu Nov 20 23:51:46 2008 +0000
+++ b/src/proto2/Physics.cc	Thu Nov 20 23:54:41 2008 +0000
@@ -7,7 +7,7 @@
 #include <cmath>
 
 PhysicsWorld::PhysicsWorld (Vector gravity, Vector dimensions)
-    : tick_timer(PHYSICS_TICK_MS), gravity(gravity), dimensions(dimensions), terrain(dimensions.x, std::vector<TerrainType>(dimensions.y, EMPTY)) {
+    : tick_timer(PHYSICS_TICK_MS), gravity(gravity), dimensions(dimensions), terrain(dimensions.x, std::vector<TerrainType>(dimensions.y, DIRT)) {
 
 	generateTerrain(1337);
 
@@ -196,7 +196,7 @@
     // some constants to control random generation
     const int min_range = 10;
     const int max_range = 40;
-    const int num = 1;
+    const int num = 30;
     const int rock_rarity = 4; // 1 / rock_rarity will be rock circle
 
     // loops for amount of circles
@@ -209,19 +209,21 @@
         // put first circle in the middle of the cave
 		// so that we have some area we can certainly spawn into 
 		if(i == 0) {
-			midx = 60;
-			midy = 60;
-			range = 50;
+			midx = dimensions.x/2;
+			midy = dimensions.y/2;
+			range = 150;
 		}
 
-        TerrainType type = DIRT;
+        TerrainType type = EMPTY;
         if(rand()%rock_rarity == 0) {
             type = ROCK;
         }
+
+    	Engine::log(DEBUG, "PhysicsObject.generta") << "Dims: " << dimensions.x << " " << dimensions.y;
         // loops for every pixel of circle
         for(int x = std::max(0, midx-range); x < std::min((int)dimensions.x, midx+range); x++) {
             for(int y = std::max(0, midy-range); y < std::min((int)dimensions.y, midy+range); y++) {
-                if(x*x+y*y < range*range) {
+                if((x-midx) * (x-midx) + (y-midy) * (y-midy) < range*range) {
                     // and sets it to type
                     terrain[x][y] = type;
                 }