DEADSOFTWARE

Minor enhancements
authorfred-boy <fred-boy@protonmail.com>
Mon, 10 Sep 2018 16:06:28 +0000 (23:06 +0700)
committerfred-boy <fred-boy@protonmail.com>
Mon, 10 Sep 2018 16:06:28 +0000 (23:06 +0700)
core/src/ru/deadsoftware/cavecraft/game/GameInput.java
core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
core/src/ru/deadsoftware/cavecraft/game/GameProc.java
core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java
core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
core/src/ru/deadsoftware/cavecraft/game/Items.java
core/src/ru/deadsoftware/cavecraft/game/WorldGen.java

index c868a8adcb4250bb29c3ccd51127ec6844a3fefb..7a66d9949b223771e0fb321f87c220fe981dafe8 100644 (file)
@@ -18,7 +18,7 @@ public class GameInput {
     }
 
     private boolean checkSwim() {
-        return (CaveGame.TOUCH && Items.isFluid(gameProc.world.getForeMap((int)(gameProc.player.position.x+gameProc.player.width/2)/16,
+        return (Items.isFluid(gameProc.world.getForeMap((int)(gameProc.player.position.x+gameProc.player.width/2)/16,
                 (int)(gameProc.player.position.y+gameProc.player.height/4*3)/16)));
     }
 
@@ -28,10 +28,12 @@ public class GameInput {
                 case Input.Keys.A:
                     gameProc.player.moveX.x = -GamePhysics.PL_SPEED;
                     gameProc.player.dir = 0;
+                    if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true;
                     break;
                 case Input.Keys.D:
                     gameProc.player.moveX.x = GamePhysics.PL_SPEED;
                     gameProc.player.dir = 1;
+                    if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true;
                     break;
             }
         } else if (CaveGame.TOUCH){
@@ -106,7 +108,7 @@ public class GameInput {
         switch (keycode) {
             case Input.Keys.A: case Input.Keys.D:
                 gameProc.player.moveX.x = 0;
-                if (gameProc.swim) gameProc.swim = false;
+                if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false;
                 break;
 
             case Input.Keys.SPACE: case Input.Keys.CONTROL_LEFT:
index a3410c2f11dceaf7822684654b0e304a000be025..372bf6e9e6e162a0f711a906ad190408a44d05c3 100644 (file)
@@ -86,15 +86,15 @@ public class GamePhysics {
         if (Items.isFluid(getBlock(pl.getRect()))) {
             if (CaveGame.TOUCH && pl.moveX.x!=0 && !gameProc.swim && !pl.flyMode) gameProc.swim = true;
             if (!gameProc.swim) {
-                if (!pl.flyMode && pl.moveY.y < 9) pl.moveY.add(gravity.x / 2, gravity.y / 2);
-                if (!pl.flyMode && pl.moveY.y > 9) pl.moveY.add(0, -.9f);
+                if (!pl.flyMode && pl.moveY.y < 4.5f) pl.moveY.add(gravity.x / 4, gravity.y / 4);
+                if (!pl.flyMode && pl.moveY.y > 4.5f) pl.moveY.add(0, -1f);
             } else {
                 pl.moveY.add(0, -.5f);
                 if (pl.moveY.y<-3) pl.moveY.y = -3;
             }
         } else {
             if (!pl.flyMode && pl.moveY.y<18) pl.moveY.add(gravity);
-            if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false;
+            //if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false;
         }
 
         pl.position.add(pl.moveX);
index 5d20e621cdc981ba66b94cabae10da0eed6bfb15..49fe7056faf70015c50f5828e724c7374052491b 100644 (file)
@@ -118,140 +118,147 @@ public class GameProc implements Serializable{
 
     private void updateFluids(int x, int y) {
         if (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y)!=8) {
-            if ((!Items.isWater(world.getForeMap(x-1,y)) ||
+            if (world.getForeMap(x, y)==60) {
+                if (!Items.isWater(world.getForeMap(x, y - 1)))
+                    world.setForeMap(x, y, world.getForeMap(x, y) + 1);
+            } else if ((!Items.isWater(world.getForeMap(x-1,y)) ||
                     (Items.isWater(world.getForeMap(x,y)) && world.getForeMap(x-1, y)>=world.getForeMap(x, y))) &&
                     (!Items.isWater(world.getForeMap(x+1,y)) ||
                             (Items.isWater(world.getForeMap(x,y)) && world.getForeMap(x+1, y)>=world.getForeMap(x, y)))){
                 world.setForeMap(x, y, world.getForeMap(x, y)+1);
-                if (world.getForeMap(x, y)>62) world.setForeMap(x, y, 0);
             }
+            if (world.getForeMap(x, y)>63) world.setForeMap(x, y, 0);
         }
 
-        if (world.getForeMap(x, y) == 8) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) ||
+        if (world.getForeMap(x, y) == 8 || world.getForeMap(x, y) == 60) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,8);
+                world.setForeMap(x,y+1,60);
                 updateBlock(x, y+2);
             } else if (Items.isLava(world.getForeMap(x, y+1))) {
                 if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4);
-                else world.setForeMap(x, y+1, 66);
+                else world.setForeMap(x, y+1, 68);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ||
-                        (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>60)) {
-                    world.setForeMap(x+1,y,60);
+                        (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>61)) {
+                    world.setForeMap(x+1,y,61);
                     updateBlock(x+1, y+1);
                 } else if (Items.isLava(world.getForeMap(x+1, y))) {
                     if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4);
-                    else world.setForeMap(x+1, y, 66);
-                } else if (world.getForeMap(x+1, y)==60 && world.getForeMap(x+2, y)==8) world.setForeMap(x+1, y, 8);
+                    else world.setForeMap(x+1, y, 68);
+                } else if (world.getForeMap(x+1, y)==61 && (world.getForeMap(x+2, y)==8 || world.getForeMap(x+2, y)==60)) world.setForeMap(x+1, y, 8);
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ||
-                        (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>60)) {
-                    world.setForeMap(x-1,y,60);
+                        (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>61)) {
+                    world.setForeMap(x-1,y,61);
                     updateBlock(x-1, y+1);
                 } else if (Items.isLava(world.getForeMap(x-1, y))) {
                     if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4);
-                    else world.setForeMap(x-1, y, 66);
-                } else if (world.getForeMap(x-1, y)==60 && world.getForeMap(x-2, y)==8) world.setForeMap(x-1, y, 8);
+                    else world.setForeMap(x-1, y, 68);
+                } else if (world.getForeMap(x-1, y)==61 && (world.getForeMap(x-2, y)==8 || world.getForeMap(x-2, y)==60)) world.setForeMap(x-1, y, 8);
             }
             return;
         }
-        if (world.getForeMap(x, y) == 60) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) ||
+        if (world.getForeMap(x, y) == 61) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,8);
+                world.setForeMap(x,y+1,60);
                 updateBlock(x, y+2);
             } else if (Items.isLava(world.getForeMap(x, y+1))) {
                 if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4);
-                else world.setForeMap(x, y+1, 66);
+                else world.setForeMap(x, y+1, 68);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ||
-                        (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>61)){
-                    world.setForeMap(x+1,y,61);
+                        (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>62)){
+                    world.setForeMap(x+1,y,62);
                     updateBlock(x+1, y+1);
                 } else if (Items.isLava(world.getForeMap(x+1, y))) {
                     if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4);
-                    else world.setForeMap(x+1, y, 66);
+                    else world.setForeMap(x+1, y, 68);
                 }
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ||
-                        (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>61)){
-                    world.setForeMap(x-1,y,61);
+                        (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>62)){
+                    world.setForeMap(x-1,y,62);
                     updateBlock(x-1, y+1);
                 } else if (Items.isLava(world.getForeMap(x-1, y))) {
                     if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4);
-                    else world.setForeMap(x-1, y, 66);
+                    else world.setForeMap(x-1, y, 68);
                 }
             }
             return;
         }
-        if (world.getForeMap(x, y) == 61) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) ||
+        if (world.getForeMap(x, y) == 62) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,8);
+                world.setForeMap(x,y+1,60);
                 updateBlock(x, y+2);
             } else if (Items.isLava(world.getForeMap(x, y+1))) {
                 if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4);
-                else world.setForeMap(x, y+1, 66);
+                else world.setForeMap(x, y+1, 68);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ){
-                    world.setForeMap(x+1,y,62);
+                    world.setForeMap(x+1,y,63);
                     updateBlock(x+1, y+1);
                 } else if (Items.isLava(world.getForeMap(x+1, y))) {
                     if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4);
-                    else world.setForeMap(x+1, y, 66);
+                    else world.setForeMap(x+1, y, 68);
                 }
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ){
-                    world.setForeMap(x-1,y,62);
+                    world.setForeMap(x-1,y,63);
                     updateBlock(x-1, y+1);
                 } else if (Items.isLava(world.getForeMap(x-1, y))) {
                     if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4);
-                    else world.setForeMap(x-1, y, 66);
+                    else world.setForeMap(x-1, y, 68);
                 }
             }
             return;
         }
-        if (world.getForeMap(x, y) == 62) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) ||
+        if (world.getForeMap(x, y) == 63) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,8);
+                world.setForeMap(x,y+1,60);
                 updateBlock(x, y+2);
             } else if (Items.isLava(world.getForeMap(x, y+1))) {
                 if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4);
-                else world.setForeMap(x, y+1, 66);
+                else world.setForeMap(x, y+1, 68);
             }
             return;
         }
 
         if (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y)!=9) {
-            if ((!Items.isLava(world.getForeMap(x-1,y)) ||
+            if (world.getForeMap(x, y)==64) {
+                if (!Items.isLava(world.getForeMap(x, y - 1)))
+                    world.setForeMap(x, y, world.getForeMap(x, y) + 1);
+            } else if ((!Items.isLava(world.getForeMap(x,y-1))) &&
+                    (!Items.isLava(world.getForeMap(x-1,y)) ||
                     (Items.isLava(world.getForeMap(x,y)) && world.getForeMap(x-1, y)>=world.getForeMap(x, y))) &&
                     (!Items.isLava(world.getForeMap(x+1,y)) ||
                             (Items.isLava(world.getForeMap(x,y)) && world.getForeMap(x+1, y)>=world.getForeMap(x, y)))){
                 world.setForeMap(x, y, world.getForeMap(x, y)+1);
-                if (world.getForeMap(x, y)>65) world.setForeMap(x, y, 0);
             }
+            if (world.getForeMap(x, y)>67) world.setForeMap(x, y, 0);
         }
 
-        if (world.getForeMap(x, y) == 9) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) ||
+        if (world.getForeMap(x, y) == 9 || world.getForeMap(x, y) == 64) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,9);
+                world.setForeMap(x,y+1,64);
                 updateBlock(x, y+2);
             } else if (Items.isWater(world.getForeMap(x, y+1))) {
                 world.setForeMap(x, y+1, 1);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ||
-                        (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>63)) {
-                    world.setForeMap(x+1,y,63);
+                        (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>65)) {
+                    world.setForeMap(x+1,y,65);
                     updateBlock(x+1, y+1);
                 } else if (Items.isWater(world.getForeMap(x+1, y))) {
                     world.setForeMap(x+1, y, 1);
@@ -259,8 +266,8 @@ public class GameProc implements Serializable{
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ||
-                        (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>63)) {
-                    world.setForeMap(x-1,y,63);
+                        (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>65)) {
+                    world.setForeMap(x-1,y,65);
                     updateBlock(x-1, y+1);
                 } else if (Items.isWater(world.getForeMap(x-1, y))) {
                     world.setForeMap(x-1, y, 1);
@@ -268,18 +275,18 @@ public class GameProc implements Serializable{
             }
             return;
         }
-        if (world.getForeMap(x, y) == 63) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) ||
+        if (world.getForeMap(x, y) == 65) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,9);
+                world.setForeMap(x,y+1,64);
                 updateBlock(x, y+2);
             } else if (Items.isWater(world.getForeMap(x, y+1))) {
                 world.setForeMap(x, y+1, 1);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ||
-                        (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>64)){
-                    world.setForeMap(x+1,y,64);
+                        (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>66)){
+                    world.setForeMap(x+1,y,66);
                     updateBlock(x+1, y+1);
                 } else if (Items.isWater(world.getForeMap(x+1, y))) {
                     world.setForeMap(x+1, y, 1);
@@ -287,8 +294,8 @@ public class GameProc implements Serializable{
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ||
-                        (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>64)){
-                    world.setForeMap(x-1,y,64);
+                        (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>66)){
+                    world.setForeMap(x-1,y,66);
                     updateBlock(x-1, y+1);
                 } else if (Items.isWater(world.getForeMap(x-1, y))) {
                     world.setForeMap(x-1, y, 1);
@@ -296,17 +303,17 @@ public class GameProc implements Serializable{
             }
             return;
         }
-        if (world.getForeMap(x, y) == 64) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) ||
+        if (world.getForeMap(x, y) == 66) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,9);
+                world.setForeMap(x,y+1,64);
                 updateBlock(x, y+2);
             } else if (Items.isWater(world.getForeMap(x, y+1))) {
                 world.setForeMap(x, y+1, 1);
             } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) {
                 if (world.getForeMap(x+1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ){
-                    world.setForeMap(x+1,y,65);
+                    world.setForeMap(x+1,y,67);
                     updateBlock(x+1, y+1);
                 } else if (Items.isWater(world.getForeMap(x+1, y))) {
                     world.setForeMap(x+1, y, 1);
@@ -314,7 +321,7 @@ public class GameProc implements Serializable{
 
                 if (world.getForeMap(x-1, y)==0 ||
                         (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ){
-                    world.setForeMap(x-1,y,65);
+                    world.setForeMap(x-1,y,67);
                     updateBlock(x-1, y+1);
                 } else if (Items.isWater(world.getForeMap(x-1, y))) {
                     world.setForeMap(x-1, y, 1);
@@ -322,10 +329,10 @@ public class GameProc implements Serializable{
             }
             return;
         }
-        if (world.getForeMap(x, y) == 65) {
-            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) ||
+        if (world.getForeMap(x, y) == 67) {
+            if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) ||
                     (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) {
-                world.setForeMap(x,y+1,9);
+                world.setForeMap(x,y+1,64);
                 updateBlock(x, y+2);
             } else if (Items.isWater(world.getForeMap(x, y+1))) {
                 world.setForeMap(x, y+1, 1);
@@ -377,7 +384,7 @@ public class GameProc implements Serializable{
             DO_UPD = false;
         }
 
-        for (int y=(int)renderer.camera.position.y/16-1; y<(int)(renderer.camera.position.y+renderer.camera.viewportHeight)/16+1; y++) {
+        for (int y=0; y<world.getHeight(); y++) {
             for (int x=(int)renderer.camera.position.x/16-1; x<(int)(renderer.camera.position.x+renderer.camera.viewportWidth)/16+1; x++) {
                 updateFluids(x, y);
             }
index 93618f20b0b4aa0e9fae23ae8ef2f565440d46ba..d8063264b58fb34102d6dc2ed0ce5dc345af613e 100644 (file)
@@ -141,7 +141,8 @@ public class GameRenderer extends Renderer {
     private void drawGUI() {
         if (gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY)>0 ||
                 gameProc.world.getBackMap(gameProc.cursorX, gameProc.cursorY)>0 ||
-                gameProc.ctrlMode==1)
+                gameProc.ctrlMode==1 ||
+                !CaveGame.TOUCH)
             spriteBatch.draw(Assets.guiCur,
                     gameProc.cursorX*16-camera.position.x,
                     gameProc.cursorY*16-camera.position.y);
@@ -202,6 +203,7 @@ public class GameRenderer extends Renderer {
             drawString("X: "+(int)(gameProc.player.position.x/16),0, 10);
             drawString("Y: "+(int)(gameProc.player.position.y/16),0, 20);
             drawString("Mobs: "+gameProc.mobs.size(), 0, 30);
+            drawString("Block: "+Items.BLOCKS.getKeyAt(gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY)), 0, 40);
         }
 
         spriteBatch.end();
index 42050e2fb2d1b06f5bf5a24d888f7ef6f76e2e0b..88f435b78631f11c1296087bd6b697ca29989d61 100644 (file)
@@ -71,13 +71,38 @@ public class GameWorld {
         }
     }
 
+    private void placeSlab(int x, int y, int value) {
+        switch (value) {
+            case 51:
+                setForeMap(x, y, 52);
+                break;
+            case 53:
+                setForeMap(x, y, 21);
+                break;
+            case 54:
+                setForeMap(x, y, 5);
+                break;
+            case 55:
+                setForeMap(x, y, 4);
+                break;
+            case 56:
+                setForeMap(x, y, 28);
+                break;
+            case 58:
+                setForeMap(x, y, 57);
+                break;
+        }
+    }
+
     public void placeToForeground(int x, int y, int value) {
         if (getForeMap(x,y) == 0 || value == 0 || !Items.BLOCKS.getValueAt(getForeMap(x, y)).collision) {
             setForeMap(x, y, value);
-            GameProc.UPD_X = x-8;
-            GameProc.UPD_Y = y-8;
-            GameProc.DO_UPD = true;
+        } else if (Items.isSlab(value) && getForeMap(x, y) == value) {
+            placeSlab(x, y, value);
         }
+        GameProc.UPD_X = x-8;
+        GameProc.UPD_Y = y-8;
+        GameProc.DO_UPD = true;
     }
 
     public void placeToBackground(int x, int y, int value) {
index 9987cbe080ccb1425b639b2c8239ade9ed1a1851..cb2f73680fdc5ae9adeac971c07d178f37c305a5 100644 (file)
@@ -8,15 +8,19 @@ public class Items {
     public static ArrayMap<String, Block> BLOCKS = new ArrayMap<String, Block>();
 
     public static boolean isFluid(int bl) {
-        return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65);
+        return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65 || bl == 66 || bl == 67);
     }
 
     public static boolean isWater(int bl) {
-        return (bl == 8 || bl == 60 || bl == 61 || bl == 62);
+        return (bl == 8 || bl == 60 || bl == 61 || bl == 62 || bl == 63);
     }
 
     public static boolean isLava(int bl) {
-        return (bl == 9 || bl == 63 || bl == 64 || bl == 65);
+        return (bl == 9 || bl == 64 || bl == 65 || bl == 66 || bl == 67);
+    }
+
+    public static boolean isSlab(int bl) {
+        return (bl == 51 || bl == 53 || bl == 54 || bl == 55 || bl == 56 || bl == 58);
     }
 
     public static void loadBlocks() {
@@ -141,18 +145,22 @@ public class Items {
         //59
         BLOCKS.put("cactus", new Block(1, 0, 14, 16, 57, true, false, true));
         //60
-        BLOCKS.put("water_12", new Block(58,false,false,true));
+        BLOCKS.put("water_16", new Block(7,false,false,true));
         //61
-        BLOCKS.put("water_8", new Block(59,false,false,true));
+        BLOCKS.put("water_12", new Block(58,false,false,true));
         //62
-        BLOCKS.put("water_4", new Block(60,false,false,true));
+        BLOCKS.put("water_8", new Block(59,false,false,true));
         //63
-        BLOCKS.put("lava_12", new Block(61,false,false,true));
+        BLOCKS.put("water_4", new Block(60,false,false,true));
         //64
-        BLOCKS.put("lava_8", new Block(62,false,false,true));
+        BLOCKS.put("lava_16", new Block(8,false,false,true));
         //65
-        BLOCKS.put("lava_4", new Block(63,false,false,true));
+        BLOCKS.put("lava_12", new Block(61,false,false,true));
         //66
+        BLOCKS.put("lava_8", new Block(62,false,false,true));
+        //67
+        BLOCKS.put("lava_4", new Block(63,false,false,true));
+        //68
         BLOCKS.put("obsidian", new Block(65));
     }
 
index 4b4f0e8d3772e656b2a5e0d265548ff8badc8df1..bf9eadf8cb3f81847f6cca80f0e5a4ac1287e18b 100644 (file)
@@ -132,12 +132,38 @@ public class WorldGen {
                     }
                 }
             }
-            if (x>2 && x<width-2 && rand.nextInt(100)<5){
+            if (x>2 && x<width-2){
                 if (foreMap[x][height-hMap[x]-1]==0 && foreMap[x][height-hMap[x]]==2) {
-                    genOak(x,height-hMap[x]-1);
+                    switch (rand.nextInt(50)) {
+                        case 0:
+                            genOak(x, height - hMap[x] - 1);
+                            break;
+                        case 1:
+                            foreMap[x][height-hMap[x]-1] = 26;
+                            break;
+                        case 2:
+                            foreMap[x][height-hMap[x]-1] = 29;
+                            break;
+                        case 3:
+                            foreMap[x][height-hMap[x]-1] = 30;
+                            break;
+                        case 4:
+                            foreMap[x][height-hMap[x]-1] = 31;
+                            break;
+                        case 5:
+                            foreMap[x][height-hMap[x]-1] = 32;
+                            break;
+                    }
                 }
                 if (foreMap[x][height-hMap[x]-1]==0 && foreMap[x][height-hMap[x]]==10) {
-                    genCactus(x,height-hMap[x]-1);
+                    switch(rand.nextInt(20)) {
+                        case 0:
+                            genCactus(x,height-hMap[x]-1);
+                            break;
+                        case 1:
+                            foreMap[x][height-hMap[x]-1] = 27;
+                            break;
+                    }
                 }
             }
         }