DEADSOFTWARE

Some refactor
authorfred-boy <fred-boy@protonmail.com>
Sun, 30 Sep 2018 14:04:05 +0000 (21:04 +0700)
committerfred-boy <fred-boy@protonmail.com>
Sun, 30 Sep 2018 14:04:05 +0000 (21:04 +0700)
17 files changed:
core/src/ru/deadsoftware/cavecraft/GameScreen.java
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/GameSaver.java
core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
core/src/ru/deadsoftware/cavecraft/game/Items.java
core/src/ru/deadsoftware/cavecraft/game/mobs/FallingGravel.java
core/src/ru/deadsoftware/cavecraft/game/mobs/FallingSand.java
core/src/ru/deadsoftware/cavecraft/game/objects/Block.java
core/src/ru/deadsoftware/cavecraft/game/objects/Item.java
core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java
core/src/ru/deadsoftware/cavecraft/misc/Assets.java
core/src/ru/deadsoftware/cavecraft/misc/InputHandlerGame.java
core/src/ru/deadsoftware/cavecraft/misc/InputHandlerMenu.java
core/src/ru/deadsoftware/cavecraft/misc/Renderer.java

index 2704dbc4e68277ffb5eb44db0cb57b01baa22786..541bc8eafab4f50c7e2963f4d5db22d4c8ba9bb6 100644 (file)
@@ -13,7 +13,7 @@ public class GameScreen implements Screen {
     public static int FPS;
     public static boolean SHOW_DEBUG = false;
 
     public static int FPS;
     public static boolean SHOW_DEBUG = false;
 
-    private GameProc gameProc;
+    private GameProc gp;
     private Renderer renderer;
     private MenuRenderer menuRenderer;
 
     private Renderer renderer;
     private MenuRenderer menuRenderer;
 
@@ -34,7 +34,7 @@ public class GameScreen implements Screen {
     }
 
     private void game(float delta) {
     }
 
     private void game(float delta) {
-        gameProc.update(delta);
+        gp.update(delta);
     }
 
     private void menu() {
     }
 
     private void menu() {
@@ -58,21 +58,21 @@ public class GameScreen implements Screen {
                 break;
 
             case NEW_GAME:
                 break;
 
             case NEW_GAME:
-                gameProc = new GameProc();
-                renderer = gameProc.renderer;
-                Gdx.input.setInputProcessor(new InputHandlerGame(gameProc));
+                gp = new GameProc();
+                renderer = gp.renderer;
+                Gdx.input.setInputProcessor(new InputHandlerGame(gp));
                 CaveGame.STATE = AppState.GAME_PLAY;
                 break;
 
             case LOAD_GAME:
                 CaveGame.STATE = AppState.GAME_PLAY;
                 break;
 
             case LOAD_GAME:
-                gameProc = GameSaver.load();
-                renderer = gameProc.renderer;
-                Gdx.input.setInputProcessor(new InputHandlerGame(gameProc));
+                gp = GameSaver.load();
+                renderer = gp.renderer;
+                Gdx.input.setInputProcessor(new InputHandlerGame(gp));
                 CaveGame.STATE = AppState.GAME_PLAY;
                 break;
 
             case SAVE_GAME:
                 CaveGame.STATE = AppState.GAME_PLAY;
                 break;
 
             case SAVE_GAME:
-                GameSaver.save(gameProc);
+                GameSaver.save(gp);
                 CaveGame.STATE = AppState.MENU_MAIN;
                 break;
 
                 CaveGame.STATE = AppState.MENU_MAIN;
                 break;
 
@@ -94,8 +94,8 @@ public class GameScreen implements Screen {
                 break;
             case GAME_PLAY:
             case GAME_CREATIVE_INV:
                 break;
             case GAME_PLAY:
             case GAME_CREATIVE_INV:
-                gameProc.resetRenderer();
-                renderer = gameProc.renderer;
+                gp.resetRenderer();
+                renderer = gp.renderer;
                 break;
         }
     }
                 break;
         }
     }
index 7cac744d3b8d4403d0f29effeaea4fb268e21492..608ed9f4e93e1f1e45775f88dab29ad1a83875c5 100644 (file)
@@ -10,79 +10,79 @@ import ru.deadsoftware.cavecraft.misc.Assets;
 
 public class GameInput {
 
 
 public class GameInput {
 
-    private GameProc gameProc;
+    private GameProc gp;
 
 
-    public GameInput(GameProc gameProc) {
-        this.gameProc = gameProc;
+    public GameInput(GameProc gp) {
+        this.gp = gp;
     }
 
     private boolean checkSwim() {
     }
 
     private boolean checkSwim() {
-        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)));
+        return (Items.isFluid(gp.world.getForeMap((int) (gp.player.position.x + gp.player.width / 2) / 16,
+                (int) (gp.player.position.y + gp.player.height / 4 * 3) / 16)));
     }
 
     private void wasdPressed(int keycode) {
     }
 
     private void wasdPressed(int keycode) {
-        if (gameProc.ctrlMode == 0 || !CaveGame.TOUCH) {
+        if (gp.ctrlMode == 0 || !CaveGame.TOUCH) {
             switch (keycode) {
                 case Input.Keys.A:
             switch (keycode) {
                 case Input.Keys.A:
-                    gameProc.player.move.x = -GamePhysics.PL_SPEED;
-                    gameProc.player.dir = 0;
-                    if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true;
+                    gp.player.move.x = -GamePhysics.PL_SPEED;
+                    gp.player.dir = 0;
+                    if (CaveGame.TOUCH && checkSwim()) gp.swim = true;
                     break;
                 case Input.Keys.D:
                     break;
                 case Input.Keys.D:
-                    gameProc.player.move.x = GamePhysics.PL_SPEED;
-                    gameProc.player.dir = 1;
-                    if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true;
+                    gp.player.move.x = GamePhysics.PL_SPEED;
+                    gp.player.dir = 1;
+                    if (CaveGame.TOUCH && checkSwim()) gp.swim = true;
                     break;
             }
         } else if (CaveGame.TOUCH) {
             switch (keycode) {
                 case Input.Keys.A:
                     break;
             }
         } else if (CaveGame.TOUCH) {
             switch (keycode) {
                 case Input.Keys.A:
-                    gameProc.cursorX--;
+                    gp.curX--;
                     break;
                 case Input.Keys.D:
                     break;
                 case Input.Keys.D:
-                    gameProc.cursorX++;
+                    gp.curX++;
                     break;
                 case Input.Keys.W:
                     break;
                 case Input.Keys.W:
-                    gameProc.cursorY--;
+                    gp.curY--;
                     break;
                 case Input.Keys.S:
                     break;
                 case Input.Keys.S:
-                    gameProc.cursorY++;
+                    gp.curY++;
                     break;
             }
                     break;
             }
-            gameProc.blockDmg = 0;
+            gp.blockDmg = 0;
         }
     }
 
     public void keyDown(int keycode) {
         }
     }
 
     public void keyDown(int keycode) {
-        gameProc.isKeyDown = true;
-        gameProc.keyDownCode = keycode;
+        gp.isKeyDown = true;
+        gp.keyDownCode = keycode;
         if (keycode == Input.Keys.W || keycode == Input.Keys.A ||
                 keycode == Input.Keys.S || keycode == Input.Keys.D) {
             wasdPressed(keycode);
         } else switch (keycode) {
             case Input.Keys.ALT_LEFT:
                 if (CaveGame.TOUCH) {
         if (keycode == Input.Keys.W || keycode == Input.Keys.A ||
                 keycode == Input.Keys.S || keycode == Input.Keys.D) {
             wasdPressed(keycode);
         } else switch (keycode) {
             case Input.Keys.ALT_LEFT:
                 if (CaveGame.TOUCH) {
-                    gameProc.ctrlMode++;
-                    if (gameProc.ctrlMode > 1) gameProc.ctrlMode = 0;
+                    gp.ctrlMode++;
+                    if (gp.ctrlMode > 1) gp.ctrlMode = 0;
                 }
                 break;
 
             case Input.Keys.SPACE:
                 if (checkSwim()) {
                 }
                 break;
 
             case Input.Keys.SPACE:
                 if (checkSwim()) {
-                    gameProc.swim = true;
-                } else if (gameProc.player.canJump) {
-                    gameProc.player.move.add(0, -7);
-                } else if (!gameProc.player.flyMode) {
-                    gameProc.player.flyMode = true;
-                    gameProc.player.move.y = 0;
+                    gp.swim = true;
+                } else if (gp.player.canJump) {
+                    gp.player.move.add(0, -7);
+                } else if (!gp.player.flyMode) {
+                    gp.player.flyMode = true;
+                    gp.player.move.y = 0;
                 } else {
                 } else {
-                    gameProc.player.move.y = -GamePhysics.PL_SPEED;
+                    gp.player.move.y = -GamePhysics.PL_SPEED;
                 }
                 break;
 
             case Input.Keys.CONTROL_LEFT:
                 }
                 break;
 
             case Input.Keys.CONTROL_LEFT:
-                gameProc.player.move.y = GamePhysics.PL_SPEED;
+                gp.player.move.y = GamePhysics.PL_SPEED;
                 break;
 
             case Input.Keys.E:
                 break;
 
             case Input.Keys.E:
@@ -91,7 +91,7 @@ public class GameInput {
                 break;
 
             case Input.Keys.G:
                 break;
 
             case Input.Keys.G:
-                gameProc.mobs.add(new Pig(gameProc.cursorX * 16, gameProc.cursorY * 16));
+                gp.mobs.add(new Pig(gp.curX * 16, gp.curY * 16));
                 break;
 
             case Input.Keys.ESCAPE:
                 break;
 
             case Input.Keys.ESCAPE:
@@ -109,14 +109,14 @@ public class GameInput {
         switch (keycode) {
             case Input.Keys.A:
             case Input.Keys.D:
         switch (keycode) {
             case Input.Keys.A:
             case Input.Keys.D:
-                gameProc.player.move.x = 0;
-                if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false;
+                gp.player.move.x = 0;
+                if (CaveGame.TOUCH && gp.swim) gp.swim = false;
                 break;
 
             case Input.Keys.SPACE:
             case Input.Keys.CONTROL_LEFT:
                 break;
 
             case Input.Keys.SPACE:
             case Input.Keys.CONTROL_LEFT:
-                if (gameProc.player.flyMode) gameProc.player.move.y = 0;
-                if (gameProc.swim) gameProc.swim = false;
+                if (gp.player.flyMode) gp.player.move.y = 0;
+                if (gp.swim) gp.swim = false;
                 break;
         }
     }
                 break;
         }
     }
@@ -125,62 +125,62 @@ public class GameInput {
     }
 
     public void touchDown(int screenX, int screenY, int button) {
     }
 
     public void touchDown(int screenX, int screenY, int button) {
-        gameProc.touchDownTime = TimeUtils.millis();
-        gameProc.isTouchDown = true;
-        gameProc.touchDownButton = button;
-        gameProc.touchDownX = screenX;
-        gameProc.touchDownY = screenY;
+        gp.touchDownTime = TimeUtils.millis();
+        gp.isTouchDown = true;
+        gp.touchDownBtn = button;
+        gp.touchDownX = screenX;
+        gp.touchDownY = screenY;
     }
 
     public void touchUp(int screenX, int screenY, int button) {
     }
 
     public void touchUp(int screenX, int screenY, int button) {
-        if (CaveGame.TOUCH && gameProc.isKeyDown) {
-            keyUp(gameProc.keyDownCode);
-            gameProc.isKeyDown = false;
+        if (CaveGame.TOUCH && gp.isKeyDown) {
+            keyUp(gp.keyDownCode);
+            gp.isKeyDown = false;
         }
         }
-        if (gameProc.isTouchDown) {
+        if (gp.isTouchDown) {
             if (CaveGame.STATE == AppState.GAME_CREATIVE_INV &&
             if (CaveGame.STATE == AppState.GAME_CREATIVE_INV &&
-                    screenX > gameProc.renderer.camera.viewportWidth / 2 - Assets.creativeInv.getRegionWidth() / 2 &&
-                    screenX < gameProc.renderer.camera.viewportWidth / 2 + Assets.creativeInv.getRegionWidth() / 2 &&
-                    screenY > gameProc.renderer.camera.viewportHeight / 2 - Assets.creativeInv.getRegionHeight() / 2 &&
-                    screenY < gameProc.renderer.camera.viewportHeight / 2 + Assets.creativeInv.getRegionHeight() / 2) {
-                int ix = (int) (screenX - (gameProc.renderer.camera.viewportWidth / 2 - Assets.creativeInv.getRegionWidth() / 2 + 8)) / 18;
-                int iy = (int) (screenY - (gameProc.renderer.camera.viewportHeight / 2 - Assets.creativeInv.getRegionHeight() / 2 + 18)) / 18;
-                int item = gameProc.creativeScroll * 8 + (ix + iy * 8);
+                    screenX > gp.renderer.getWidth() / 2 - Assets.creativeInv.getRegionWidth() / 2 &&
+                    screenX < gp.renderer.getWidth() / 2 + Assets.creativeInv.getRegionWidth() / 2 &&
+                    screenY > gp.renderer.getHeight() / 2 - Assets.creativeInv.getRegionHeight() / 2 &&
+                    screenY < gp.renderer.getHeight() / 2 + Assets.creativeInv.getRegionHeight() / 2) {
+                int ix = (int) (screenX - (gp.renderer.getWidth() / 2 - Assets.creativeInv.getRegionWidth() / 2 + 8)) / 18;
+                int iy = (int) (screenY - (gp.renderer.getHeight() / 2 - Assets.creativeInv.getRegionHeight() / 2 + 18)) / 18;
+                int item = gp.creativeScroll * 8 + (ix + iy * 8);
                 if (ix >= 8 || ix < 0 || iy < 0 || iy >= 5) item = -1;
                 if (ix >= 8 || ix < 0 || iy < 0 || iy >= 5) item = -1;
-                if (item >= 0 && item < Items.ITEMS.size()) {
+                if (item >= 0 && item < Items.items.size()) {
                     for (int i = 8; i > 0; i--) {
                     for (int i = 8; i > 0; i--) {
-                        gameProc.player.inventory[i] = gameProc.player.inventory[i - 1];
+                        gp.player.inventory[i] = gp.player.inventory[i - 1];
                     }
                     }
-                    gameProc.player.inventory[0] = item;
+                    gp.player.inventory[0] = item;
                 }
             } else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) {
                 CaveGame.STATE = AppState.GAME_PLAY;
             } else if (screenY < Assets.invBar.getRegionHeight() &&
                 }
             } else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) {
                 CaveGame.STATE = AppState.GAME_PLAY;
             } else if (screenY < Assets.invBar.getRegionHeight() &&
-                    screenX > gameProc.renderer.camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2 &&
-                    screenX < gameProc.renderer.camera.viewportWidth / 2 + Assets.invBar.getRegionWidth() / 2) {
-                gameProc.invSlot = (int) ((screenX - (gameProc.renderer.camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2)) / 20);
+                    screenX > gp.renderer.getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 &&
+                    screenX < gp.renderer.getWidth() / 2 + Assets.invBar.getRegionWidth() / 2) {
+                gp.invSlot = (int) ((screenX - (gp.renderer.getWidth() / 2 - Assets.invBar.getRegionWidth() / 2)) / 20);
             } else if (button == Input.Buttons.RIGHT) {
             } else if (button == Input.Buttons.RIGHT) {
-                gameProc.useItem(gameProc.cursorX, gameProc.cursorY,
-                        gameProc.player.inventory[gameProc.invSlot], false);
+                gp.useItem(gp.curX, gp.curY,
+                        gp.player.inventory[gp.invSlot], false);
             } else if (button == Input.Buttons.LEFT) {
             } else if (button == Input.Buttons.LEFT) {
-                gameProc.blockDmg = 0;
+                gp.blockDmg = 0;
             }
         }
             }
         }
-        gameProc.isTouchDown = false;
+        gp.isTouchDown = false;
     }
 
     public void touchDragged(int screenX, int screenY) {
     }
 
     public void touchDragged(int screenX, int screenY) {
-        if (CaveGame.STATE == AppState.GAME_CREATIVE_INV && Math.abs(screenY - gameProc.touchDownY) > 16) {
-            if (screenX > gameProc.renderer.camera.viewportWidth / 2 - Assets.creativeInv.getRegionWidth() / 2 &&
-                    screenX < gameProc.renderer.camera.viewportWidth / 2 + Assets.creativeInv.getRegionWidth() / 2 &&
-                    screenY > gameProc.renderer.camera.viewportHeight / 2 - Assets.creativeInv.getRegionHeight() / 2 &&
-                    screenY < gameProc.renderer.camera.viewportHeight / 2 + Assets.creativeInv.getRegionHeight() / 2) {
-                gameProc.creativeScroll -= (screenY - gameProc.touchDownY) / 16;
-                gameProc.touchDownX = screenX;
-                gameProc.touchDownY = screenY;
-                if (gameProc.creativeScroll < 0) gameProc.creativeScroll = 0;
-                if (gameProc.creativeScroll > gameProc.maxCreativeScroll)
-                    gameProc.creativeScroll = gameProc.maxCreativeScroll;
+        if (CaveGame.STATE == AppState.GAME_CREATIVE_INV && Math.abs(screenY - gp.touchDownY) > 16) {
+            if (screenX > gp.renderer.getWidth() / 2 - Assets.creativeInv.getRegionWidth() / 2 &&
+                    screenX < gp.renderer.getWidth() / 2 + Assets.creativeInv.getRegionWidth() / 2 &&
+                    screenY > gp.renderer.getHeight() / 2 - Assets.creativeInv.getRegionHeight() / 2 &&
+                    screenY < gp.renderer.getHeight() / 2 + Assets.creativeInv.getRegionHeight() / 2) {
+                gp.creativeScroll -= (screenY - gp.touchDownY) / 16;
+                gp.touchDownX = screenX;
+                gp.touchDownY = screenY;
+                if (gp.creativeScroll < 0) gp.creativeScroll = 0;
+                if (gp.creativeScroll > gp.maxCreativeScroll)
+                    gp.creativeScroll = gp.maxCreativeScroll;
             }
         }
     }
             }
         }
     }
@@ -188,15 +188,15 @@ public class GameInput {
     public void scrolled(int amount) {
         switch (CaveGame.STATE) {
             case GAME_PLAY:
     public void scrolled(int amount) {
         switch (CaveGame.STATE) {
             case GAME_PLAY:
-                gameProc.invSlot += amount;
-                if (gameProc.invSlot < 0) gameProc.invSlot = 8;
-                if (gameProc.invSlot > 8) gameProc.invSlot = 0;
+                gp.invSlot += amount;
+                if (gp.invSlot < 0) gp.invSlot = 8;
+                if (gp.invSlot > 8) gp.invSlot = 0;
                 break;
             case GAME_CREATIVE_INV:
                 break;
             case GAME_CREATIVE_INV:
-                gameProc.creativeScroll += amount;
-                if (gameProc.creativeScroll < 0) gameProc.creativeScroll = 0;
-                if (gameProc.creativeScroll > gameProc.maxCreativeScroll)
-                    gameProc.creativeScroll = gameProc.maxCreativeScroll;
+                gp.creativeScroll += amount;
+                if (gp.creativeScroll < 0) gp.creativeScroll = 0;
+                if (gp.creativeScroll > gp.maxCreativeScroll)
+                    gp.creativeScroll = gp.maxCreativeScroll;
                 break;
         }
     }
                 break;
         }
     }
index 142e959a1a3c97a17b2bd18c8f3864b416b14585..fe0765a0fa06b9f06a17344a3973ad82b2637e41 100644 (file)
@@ -15,12 +15,12 @@ public class GamePhysics {
 
     public static final int PL_SPEED = 2;
 
 
     public static final int PL_SPEED = 2;
 
-    private GameProc gameProc;
+    private GameProc gp;
 
     private Vector2 gravity;
 
 
     private Vector2 gravity;
 
-    public GamePhysics(GameProc gameProc) {
-        this.gameProc = gameProc;
+    public GamePhysics(GameProc gp) {
+        this.gp = gp;
         gravity = new Vector2(0, .9f);
     }
 
         gravity = new Vector2(0, .9f);
     }
 
@@ -28,18 +28,18 @@ public class GamePhysics {
         int bl;
         switch (dir) {
             case 0:
         int bl;
         switch (dir) {
             case 0:
-                bl = gameProc.world.getForeMap((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16));
+                bl = gp.world.getForeMap((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16));
                 if (checkColl(new Rectangle(rect.x - 8, rect.y - 18, rect.width, rect.height))) bl = 0;
                 break;
             case 1:
                 if (checkColl(new Rectangle(rect.x - 8, rect.y - 18, rect.width, rect.height))) bl = 0;
                 break;
             case 1:
-                bl = gameProc.world.getForeMap((int) ((rect.x + rect.width + 8) / 16), (int) ((rect.y + rect.height - 8) / 16));
+                bl = gp.world.getForeMap((int) ((rect.x + rect.width + 8) / 16), (int) ((rect.y + rect.height - 8) / 16));
                 if (checkColl(new Rectangle(rect.x + rect.width + 8, rect.y - 18, rect.width, rect.height))) bl = 0;
                 break;
             default:
                 bl = 0;
         }
                 if (checkColl(new Rectangle(rect.x + rect.width + 8, rect.y - 18, rect.width, rect.height))) bl = 0;
                 break;
             default:
                 bl = 0;
         }
-        return (bl > 0 && Items.BLOCKS.getValueAt(bl).toJump() &&
-                (rect.y + rect.height) - Items.BLOCKS.getValueAt(bl).getRect((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16)).y > 8);
+        return (bl > 0 && Items.blocks.getValueAt(bl).toJump() &&
+                (rect.y + rect.height) - Items.blocks.getValueAt(bl).getRect((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16)).y > 8);
     }
 
     private boolean checkColl(Rectangle rect) {
     }
 
     private boolean checkColl(Rectangle rect) {
@@ -49,12 +49,12 @@ public class GamePhysics {
         int maxX = (int) ((rect.x + rect.width / 2) / 16) + 4;
         int maxY = (int) ((rect.y + rect.height / 2) / 16) + 4;
         if (minY < 0) minY = 0;
         int maxX = (int) ((rect.x + rect.width / 2) / 16) + 4;
         int maxY = (int) ((rect.y + rect.height / 2) / 16) + 4;
         if (minY < 0) minY = 0;
-        if (maxY > gameProc.world.getHeight()) maxY = gameProc.world.getHeight();
+        if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight();
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
-                bl = gameProc.world.getForeMap(x, y);
-                if (bl > 0 && Items.BLOCKS.getValueAt(bl).collision) {
-                    if (Intersector.overlaps(rect, Items.BLOCKS.getValueAt(bl).getRect(x, y))) {
+                bl = gp.world.getForeMap(x, y);
+                if (bl > 0 && Items.blocks.getValueAt(bl).coll) {
+                    if (Intersector.overlaps(rect, Items.blocks.getValueAt(bl).getRect(x, y))) {
                         return true;
                     }
                 }
                         return true;
                     }
                 }
@@ -64,7 +64,7 @@ public class GamePhysics {
     }
 
     private int getBlock(Rectangle rect) {
     }
 
     private int getBlock(Rectangle rect) {
-        return gameProc.world.getForeMap((int) (rect.x + rect.width / 2) / 16, (int) (rect.y + rect.height / 8 * 7) / 16);
+        return gp.world.getForeMap((int) (rect.x + rect.width / 2) / 16, (int) (rect.y + rect.height / 8 * 7) / 16);
     }
 
     private void dropPhy(Drop drop) {
     }
 
     private void dropPhy(Drop drop) {
@@ -94,8 +94,8 @@ public class GamePhysics {
         }
 
         if (Items.isFluid(getBlock(pl.getRect()))) {
         }
 
         if (Items.isFluid(getBlock(pl.getRect()))) {
-            if (CaveGame.TOUCH && pl.move.x != 0 && !gameProc.swim && !pl.flyMode) gameProc.swim = true;
-            if (!gameProc.swim) {
+            if (CaveGame.TOUCH && pl.move.x != 0 && !gp.swim && !pl.flyMode) gp.swim = true;
+            if (!gp.swim) {
                 if (!pl.flyMode && pl.move.y < 4.5f) pl.move.add(gravity.x / 4, gravity.y / 4);
                 if (!pl.flyMode && pl.move.y > 4.5f) pl.move.add(0, -1f);
             } else {
                 if (!pl.flyMode && pl.move.y < 4.5f) pl.move.add(gravity.x / 4, gravity.y / 4);
                 if (!pl.flyMode && pl.move.y > 4.5f) pl.move.add(0, -1f);
             } else {
@@ -118,11 +118,11 @@ public class GamePhysics {
                 while (checkColl(pl.getRect())) pl.position.x += d;
             }
         }
                 while (checkColl(pl.getRect())) pl.position.x += d;
             }
         }
-        if (pl.position.x + pl.texWidth / 2 < 0) pl.position.x += gameProc.world.getWidth() * 16;
-        if (pl.position.x + pl.texWidth / 2 > gameProc.world.getWidth() * 16)
-            pl.position.x -= gameProc.world.getWidth() * 16;
-        if (pl.position.y > gameProc.world.getHeight() * 16) {
-            pl.position = gameProc.world.getSpawnPoint().cpy();
+        if (pl.position.x + pl.texWidth / 2 < 0) pl.position.x += gp.world.getWidth() * 16;
+        if (pl.position.x + pl.texWidth / 2 > gp.world.getWidth() * 16)
+            pl.position.x -= gp.world.getWidth() * 16;
+        if (pl.position.y > gp.world.getHeight() * 16) {
+            pl.position = gp.world.getSpawnPoint().cpy();
         }
         if (CaveGame.TOUCH && checkJump(pl.getRect(), pl.dir) && !pl.flyMode && pl.canJump && pl.move.x != 0) {
             pl.move.add(0, -8);
         }
         if (CaveGame.TOUCH && checkJump(pl.getRect(), pl.dir) && !pl.flyMode && pl.canJump && pl.move.x != 0) {
             pl.move.add(0, -8);
@@ -140,7 +140,7 @@ public class GamePhysics {
             while (checkColl(mob.getRect())) mob.position.y += d;
             mob.move.y = 0;
             if (mob.getType() > 0) {
             while (checkColl(mob.getRect())) mob.position.y += d;
             mob.move.y = 0;
             if (mob.getType() > 0) {
-                gameProc.world.setForeMap((int) mob.position.x / 16, (int) mob.position.y / 16, mob.getType());
+                gp.world.setForeMap((int) mob.position.x / 16, (int) mob.position.y / 16, mob.getType());
                 mob.position.y = -1;
                 mob.dead = true;
             }
                 mob.position.y = -1;
                 mob.dead = true;
             }
@@ -169,10 +169,10 @@ public class GamePhysics {
                 if (mob.canJump) mob.changeDir();
             }
         }
                 if (mob.canJump) mob.changeDir();
             }
         }
-        if (mob.position.x + mob.width / 2 < 0) mob.position.x += gameProc.world.getWidth() * 16;
-        if (mob.position.x + mob.width / 2 > gameProc.world.getWidth() * 16)
-            mob.position.x -= gameProc.world.getWidth() * 16;
-        if (mob.position.y > gameProc.world.getHeight() * 16) {
+        if (mob.position.x + mob.width / 2 < 0) mob.position.x += gp.world.getWidth() * 16;
+        if (mob.position.x + mob.width / 2 > gp.world.getWidth() * 16)
+            mob.position.x -= gp.world.getWidth() * 16;
+        if (mob.position.y > gp.world.getHeight() * 16) {
             mob.position.y = 0;
         }
         if (checkJump(mob.getRect(), mob.dir) && mob.canJump && mob.move.x != 0) {
             mob.position.y = 0;
         }
         if (checkJump(mob.getRect(), mob.dir) && mob.canJump && mob.move.x != 0) {
@@ -182,15 +182,15 @@ public class GamePhysics {
     }
 
     public void update(float delta) {
     }
 
     public void update(float delta) {
-        for (Iterator<Drop> it = gameProc.drops.iterator(); it.hasNext(); ) {
+        for (Iterator<Drop> it = gp.drops.iterator(); it.hasNext(); ) {
             Drop drop = it.next();
             dropPhy(drop);
             Drop drop = it.next();
             dropPhy(drop);
-            if (Intersector.overlaps(drop.getRect(), gameProc.player.getRect()))
-                drop.pickUpDrop(gameProc.player);
+            if (Intersector.overlaps(drop.getRect(), gp.player.getRect()))
+                drop.pickUpDrop(gp.player);
             if (drop.pickedUp) it.remove();
         }
 
             if (drop.pickedUp) it.remove();
         }
 
-        for (Iterator<Mob> it = gameProc.mobs.iterator(); it.hasNext(); ) {
+        for (Iterator<Mob> it = gp.mobs.iterator(); it.hasNext(); ) {
             Mob mob = it.next();
             mob.ai();
             mobPhy(mob);
             Mob mob = it.next();
             mob.ai();
             mobPhy(mob);
@@ -198,13 +198,11 @@ public class GamePhysics {
                 it.remove();
         }
 
                 it.remove();
         }
 
-        playerPhy(gameProc.player);
+        playerPhy(gp.player);
 
 
-        gameProc.renderer.camera.position.set(
-                gameProc.player.position.x + gameProc.player.texWidth / 2 - gameProc.renderer.camera.viewportWidth / 2,
-                gameProc.player.position.y + gameProc.player.height / 2 - gameProc.renderer.camera.viewportHeight / 2,
-                0
-        );
+        gp.renderer.setCamPos(
+                gp.player.position.x + gp.player.texWidth / 2 - gp.renderer.getWidth() / 2,
+                gp.player.position.y + gp.player.height / 2 - gp.renderer.getHeight() / 2);
     }
 
 }
     }
 
 }
index e4d12b285c025e31233b09217875c32567f1a09e..f79694f713159318b9fb19b5ad2c634d70dc03f4 100644 (file)
@@ -33,7 +33,7 @@ public class GameProc implements Serializable {
     public transient GameRenderer renderer;
     public transient GamePhysics physics;
 
     public transient GameRenderer renderer;
     public transient GamePhysics physics;
 
-    public int cursorX, cursorY;
+    public int curX, curY;
     public int invSlot;
     public int ctrlMode;
     public int creativeScroll, maxCreativeScroll;
     public int invSlot;
     public int ctrlMode;
     public int creativeScroll, maxCreativeScroll;
@@ -41,7 +41,7 @@ public class GameProc implements Serializable {
 
     public boolean isTouchDown, isKeyDown, swim;
     public int touchDownX, touchDownY, keyDownCode;
 
     public boolean isTouchDown, isKeyDown, swim;
     public int touchDownX, touchDownY, keyDownCode;
-    public int touchDownButton;
+    public int touchDownBtn;
     public long touchDownTime;
 
     public GameProc() {
     public long touchDownTime;
 
     public GameProc() {
@@ -62,7 +62,7 @@ public class GameProc implements Serializable {
             renderer = new GameRenderer(this, 480,
                     480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
         }
             renderer = new GameRenderer(this, 480,
                     480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
         }
-        maxCreativeScroll = Items.ITEMS.size() / 8;
+        maxCreativeScroll = Items.items.size() / 8;
         GameSaver.save(this);
     }
 
         GameSaver.save(this);
     }
 
@@ -78,45 +78,45 @@ public class GameProc implements Serializable {
 
     private boolean isAutoselectable(int x, int y) {
         return (world.getForeMap(x, y) > 0 &&
 
     private boolean isAutoselectable(int x, int y) {
         return (world.getForeMap(x, y) > 0 &&
-                Items.BLOCKS.getValueAt(world.getForeMap(x, y)).collision);
+                Items.blocks.getValueAt(world.getForeMap(x, y)).coll);
     }
 
     private void moveCursor() {
     }
 
     private void moveCursor() {
-        int pastX = cursorX, pastY = cursorY;
+        int pastX = curX, pastY = curY;
         if (ctrlMode == 0 && CaveGame.TOUCH) {
         if (ctrlMode == 0 && CaveGame.TOUCH) {
-            cursorX = (int) (player.position.x + player.texWidth / 2) / 16;
-            if (player.dir == 0) cursorX--;
-            else cursorX++;
-            cursorY = (int) (player.position.y + player.texWidth) / 16;
-            if (!isAutoselectable(cursorX, cursorY)) {
-                cursorY++;
+            curX = (int) (player.position.x + player.texWidth / 2) / 16;
+            if (player.dir == 0) curX--;
+            else curX++;
+            curY = (int) (player.position.y + player.texWidth) / 16;
+            if (!isAutoselectable(curX, curY)) {
+                curY++;
             }
             }
-            if (!isAutoselectable(cursorX, cursorY)) {
-                cursorY++;
+            if (!isAutoselectable(curX, curY)) {
+                curY++;
             }
             }
-            if (!isAutoselectable(cursorX, cursorY)) {
-                if (player.dir == 0) cursorX++;
-                else cursorX--;
+            if (!isAutoselectable(curX, curY)) {
+                if (player.dir == 0) curX++;
+                else curX--;
             }
         } else if (!CaveGame.TOUCH) {
             }
         } else if (!CaveGame.TOUCH) {
-            cursorX = (int) (Gdx.input.getX() *
-                    (renderer.camera.viewportWidth / GameScreen.getWidth()) + renderer.camera.position.x) / 16;
-            cursorY = (int) (Gdx.input.getY() *
-                    (renderer.camera.viewportHeight / GameScreen.getHeight()) + renderer.camera.position.y) / 16;
+            curX = (int) (Gdx.input.getX() *
+                    (renderer.getWidth() / GameScreen.getWidth()) + renderer.getCamX()) / 16;
+            curY = (int) (Gdx.input.getY() *
+                    (renderer.getHeight() / GameScreen.getHeight()) + renderer.getCamY()) / 16;
             if ((Gdx.input.getX() *
             if ((Gdx.input.getX() *
-                    (renderer.camera.viewportWidth / GameScreen.getWidth()) + renderer.camera.position.x) < 0)
-                cursorX--;
+                    (renderer.getWidth() / GameScreen.getWidth()) + renderer.getCamX()) < 0)
+                curX--;
         }
         }
-        if (pastX != cursorX || pastY != cursorY) blockDmg = 0;
+        if (pastX != curX || pastY != curY) blockDmg = 0;
     }
 
     private void checkCursorBounds() {
     }
 
     private void checkCursorBounds() {
-        if (cursorY < 0) cursorY = 0;
-        if (cursorY >= world.getHeight()) cursorY = world.getHeight() - 1;
+        if (curY < 0) curY = 0;
+        if (curY >= world.getHeight()) curY = world.getHeight() - 1;
         if (ctrlMode == 1) {
         if (ctrlMode == 1) {
-            if (cursorX * 16 + 8 < player.position.x + player.texWidth / 2)
+            if (curX * 16 + 8 < player.position.x + player.texWidth / 2)
                 player.dir = 0;
                 player.dir = 0;
-            if (cursorX * 16 + 8 > player.position.x + player.texWidth / 2)
+            if (curX * 16 + 8 > player.position.x + player.texWidth / 2)
                 player.dir = 1;
         }
     }
                 player.dir = 1;
         }
     }
@@ -137,15 +137,15 @@ public class GameProc implements Serializable {
 
         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) ||
 
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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, 68);
                 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, 68);
-            } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !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);
                     updateBlock(x + 1, y + 1);
                         (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) {
                     world.setForeMap(x + 1, y, 61);
                     updateBlock(x + 1, y + 1);
@@ -156,7 +156,7 @@ public class GameProc implements Serializable {
                     world.setForeMap(x + 1, y, 8);
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                     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.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !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);
                     updateBlock(x - 1, y + 1);
                         (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) {
                     world.setForeMap(x - 1, y, 61);
                     updateBlock(x - 1, y + 1);
@@ -170,15 +170,15 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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, 68);
                 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, 68);
-            } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
                         (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) {
                     world.setForeMap(x + 1, y, 62);
                     updateBlock(x + 1, y + 1);
                         (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) {
                     world.setForeMap(x + 1, y, 62);
                     updateBlock(x + 1, y + 1);
@@ -188,7 +188,7 @@ public class GameProc implements Serializable {
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x - 1, y)).collision && !Items.isFluid(world.getForeMap(x - 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
                         (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) {
                     world.setForeMap(x - 1, y, 62);
                     updateBlock(x - 1, y + 1);
                         (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) {
                     world.setForeMap(x - 1, y, 62);
                     updateBlock(x - 1, y + 1);
@@ -201,15 +201,15 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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, 68);
                 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, 68);
-            } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y)))) {
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) {
                     world.setForeMap(x + 1, y, 63);
                     updateBlock(x + 1, y + 1);
                 } else if (Items.isLava(world.getForeMap(x + 1, y))) {
                     world.setForeMap(x + 1, y, 63);
                     updateBlock(x + 1, y + 1);
                 } else if (Items.isLava(world.getForeMap(x + 1, y))) {
@@ -218,7 +218,7 @@ public class GameProc implements Serializable {
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x - 1, y)).collision && !Items.isFluid(world.getForeMap(x - 1, y)))) {
+                        (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) {
                     world.setForeMap(x - 1, y, 63);
                     updateBlock(x - 1, y + 1);
                 } else if (Items.isLava(world.getForeMap(x - 1, y))) {
                     world.setForeMap(x - 1, y, 63);
                     updateBlock(x - 1, y + 1);
                 } else if (Items.isLava(world.getForeMap(x - 1, y))) {
@@ -230,7 +230,7 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 world.setForeMap(x, y + 1, 60);
                 updateBlock(x, y + 2);
             } else if (Items.isLava(world.getForeMap(x, y + 1))) {
                 world.setForeMap(x, y + 1, 60);
                 updateBlock(x, y + 2);
             } else if (Items.isLava(world.getForeMap(x, y + 1))) {
@@ -256,14 +256,14 @@ public class GameProc implements Serializable {
 
         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) ||
 
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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);
                 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) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
                         (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) {
                     world.setForeMap(x + 1, y, 65);
                     updateBlock(x + 1, y + 1);
                         (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) {
                     world.setForeMap(x + 1, y, 65);
                     updateBlock(x + 1, y + 1);
@@ -272,7 +272,7 @@ public class GameProc implements Serializable {
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x - 1, y)).collision && !Items.isFluid(world.getForeMap(x - 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
                         (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) {
                     world.setForeMap(x - 1, y, 65);
                     updateBlock(x - 1, y + 1);
                         (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) {
                     world.setForeMap(x - 1, y, 65);
                     updateBlock(x - 1, y + 1);
@@ -284,14 +284,14 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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);
                 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) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) ||
                         (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) {
                     world.setForeMap(x + 1, y, 66);
                     updateBlock(x + 1, y + 1);
                         (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) {
                     world.setForeMap(x + 1, y, 66);
                     updateBlock(x + 1, y + 1);
@@ -300,7 +300,7 @@ public class GameProc implements Serializable {
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x - 1, y)).collision && !Items.isFluid(world.getForeMap(x - 1, y))) ||
+                        (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) ||
                         (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) {
                     world.setForeMap(x - 1, y, 66);
                     updateBlock(x - 1, y + 1);
                         (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) {
                     world.setForeMap(x - 1, y, 66);
                     updateBlock(x - 1, y + 1);
@@ -312,14 +312,14 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 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);
                 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) {
+            } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 if (world.getForeMap(x + 1, y) == 0 ||
                 if (world.getForeMap(x + 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x + 1, y)).collision && !Items.isFluid(world.getForeMap(x + 1, y)))) {
+                        (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) {
                     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, 67);
                     updateBlock(x + 1, y + 1);
                 } else if (Items.isWater(world.getForeMap(x + 1, y))) {
@@ -327,7 +327,7 @@ public class GameProc implements Serializable {
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
                 }
 
                 if (world.getForeMap(x - 1, y) == 0 ||
-                        (!Items.BLOCKS.getValueAt(world.getForeMap(x - 1, y)).collision && !Items.isFluid(world.getForeMap(x - 1, y)))) {
+                        (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) {
                     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, 67);
                     updateBlock(x - 1, y + 1);
                 } else if (Items.isWater(world.getForeMap(x - 1, y))) {
@@ -338,7 +338,7 @@ public class GameProc implements Serializable {
         }
         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) ||
         }
         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)))) {
+                    (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) {
                 world.setForeMap(x, y + 1, 64);
                 updateBlock(x, y + 2);
             } else if (Items.isWater(world.getForeMap(x, y + 1))) {
                 world.setForeMap(x, y + 1, 64);
                 updateBlock(x, y + 2);
             } else if (Items.isWater(world.getForeMap(x, y + 1))) {
@@ -350,7 +350,7 @@ public class GameProc implements Serializable {
 
     private void updateBlock(int x, int y) {
         if (world.getForeMap(x, y) == 10) {
 
     private void updateBlock(int x, int y) {
         if (world.getForeMap(x, y) == 10) {
-            if (world.getForeMap(x, y + 1) == 0 || !Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 world.setForeMap(x, y, 0);
                 mobs.add(new FallingSand(x * 16, y * 16));
                 updateBlock(x, y - 1);
                 world.setForeMap(x, y, 0);
                 mobs.add(new FallingSand(x * 16, y * 16));
                 updateBlock(x, y - 1);
@@ -358,7 +358,7 @@ public class GameProc implements Serializable {
         }
 
         if (world.getForeMap(x, y) == 11) {
         }
 
         if (world.getForeMap(x, y) == 11) {
-            if (world.getForeMap(x, y + 1) == 0 || !Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 world.setForeMap(x, y, 0);
                 mobs.add(new FallingGravel(x * 16, y * 16));
                 updateBlock(x, y - 1);
                 world.setForeMap(x, y, 0);
                 mobs.add(new FallingGravel(x * 16, y * 16));
                 updateBlock(x, y - 1);
@@ -366,14 +366,14 @@ public class GameProc implements Serializable {
         }
 
         if (world.getForeMap(x, y) == 59) {
         }
 
         if (world.getForeMap(x, y) == 59) {
-            if (world.getForeMap(x, y + 1) == 0 || !Items.BLOCKS.getValueAt(world.getForeMap(x, y + 1)).collision) {
+            if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) {
                 world.setForeMap(x, y, 0);
                 updateBlock(x, y - 1);
             }
         }
 
         if (world.getForeMap(x, y) == 2) {
                 world.setForeMap(x, y, 0);
                 updateBlock(x, y - 1);
             }
         }
 
         if (world.getForeMap(x, y) == 2) {
-            if (world.getForeMap(x, y - 1) > 0 && (Items.BLOCKS.getValueAt(world.getForeMap(x, y - 1)).collision ||
+            if (world.getForeMap(x, y - 1) > 0 && (Items.blocks.getValueAt(world.getForeMap(x, y - 1)).coll ||
                     Items.isFluid(world.getForeMap(x, y - 1)))) {
                 world.setForeMap(x, y, 3);
             }
                     Items.isFluid(world.getForeMap(x, y - 1)))) {
                 world.setForeMap(x, y, 3);
             }
@@ -381,9 +381,9 @@ public class GameProc implements Serializable {
     }
 
     public void useItem(int x, int y, int id, boolean bg) {
     }
 
     public void useItem(int x, int y, int id, boolean bg) {
-        if (id > 0 && Items.ITEMS.get(id).getType() == 0) {
-            if (!bg) world.placeToForeground(x, y, Items.ITEMS.get(id).getBlock());
-            else world.placeToBackground(x, y, Items.ITEMS.get(id).getBlock());
+        if (id > 0 && Items.items.get(id).getType() == 0) {
+            if (!bg) world.placeToForeground(x, y, Items.items.get(id).getBlock());
+            else world.placeToBackground(x, y, Items.items.get(id).getBlock());
         }
     }
 
         }
     }
 
@@ -399,7 +399,7 @@ public class GameProc implements Serializable {
         }
 
         for (int y = 0; y < world.getHeight(); 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++) {
+            for (int x = (int) renderer.getCamX() / 16 - 1; x < (int) (renderer.getCamX() + renderer.getWidth()) / 16 + 1; x++) {
                 updateFluids(x, y);
             }
         }
                 updateFluids(x, y);
             }
         }
@@ -408,26 +408,26 @@ public class GameProc implements Serializable {
         moveCursor();
         checkCursorBounds();
 
         moveCursor();
         checkCursorBounds();
 
-        if (isTouchDown && touchDownButton == Input.Buttons.LEFT) {
-            if (world.getForeMap(cursorX, cursorY) > 0 &&
-                    Items.BLOCKS.getValueAt(world.getForeMap(cursorX, cursorY)).getHp() >= 0) {// || world.getBackMap(cursorX, cursorY) > 0) {
+        if (isTouchDown && touchDownBtn == Input.Buttons.LEFT) {
+            if (world.getForeMap(curX, curY) > 0 &&
+                    Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp() >= 0) {// || world.getBackMap(curX, curY) > 0) {
                 blockDmg++;
                 blockDmg++;
-                if (blockDmg >= Items.BLOCKS.getValueAt(world.getForeMap(cursorX, cursorY)).getHp()) {
-                    if (Items.BLOCKS.getValueAt(world.getForeMap(cursorX, cursorY)).getDrop() > 0)
-                        drops.add(new Drop(cursorX * 16 + 4, cursorY * 16 + 4, Items.BLOCKS.getValueAt(world.getForeMap(cursorX, cursorY)).getDrop()));
-                    world.placeToForeground(cursorX, cursorY, 0);
+                if (blockDmg >= Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp()) {
+                    if (Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop() > 0)
+                        drops.add(new Drop(curX * 16 + 4, curY * 16 + 4, Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop()));
+                    world.placeToForeground(curX, curY, 0);
                     blockDmg = 0;
                 }
             }
         }
 
         if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) {
                     blockDmg = 0;
                 }
             }
         }
 
         if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) {
-            if (touchDownButton == Input.Buttons.RIGHT) {
-                useItem(cursorX, cursorY, player.inventory[invSlot], true);
+            if (touchDownBtn == Input.Buttons.RIGHT) {
+                useItem(curX, curY, player.inventory[invSlot], true);
                 isTouchDown = false;
             } else if (touchDownY < Assets.invBar.getRegionHeight() &&
                 isTouchDown = false;
             } else if (touchDownY < Assets.invBar.getRegionHeight() &&
-                    touchDownX > renderer.camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2 &&
-                    touchDownX < renderer.camera.viewportWidth / 2 + Assets.invBar.getRegionWidth() / 2) {
+                    touchDownX > renderer.getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 &&
+                    touchDownX < renderer.getWidth() / 2 + Assets.invBar.getRegionWidth() / 2) {
                 CaveGame.STATE = AppState.GAME_CREATIVE_INV;
                 isTouchDown = false;
             }
                 CaveGame.STATE = AppState.GAME_CREATIVE_INV;
                 isTouchDown = false;
             }
index 8ed1ebd430ac64d6d20e18ca858da52223563b96..cbcaeb801c1e170cee00f29a90eefefe8625fc62 100644 (file)
@@ -3,7 +3,6 @@ package ru.deadsoftware.cavecraft.game;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.math.MathUtils;
-import com.badlogic.gdx.math.Vector2;
 import ru.deadsoftware.cavecraft.CaveGame;
 import ru.deadsoftware.cavecraft.GameScreen;
 import ru.deadsoftware.cavecraft.game.mobs.Mob;
 import ru.deadsoftware.cavecraft.CaveGame;
 import ru.deadsoftware.cavecraft.GameScreen;
 import ru.deadsoftware.cavecraft.game.mobs.Mob;
@@ -14,173 +13,194 @@ import ru.deadsoftware.cavecraft.misc.Renderer;
 
 public class GameRenderer extends Renderer {
 
 
 public class GameRenderer extends Renderer {
 
-    private GameProc gameProc;
+    private GameProc gp;
 
 
-    public GameRenderer(GameProc gameProc, float width, float heigth) {
+    public GameRenderer(GameProc gp, float width, float heigth) {
         super(width, heigth);
         Gdx.gl.glClearColor(0f, .6f, .6f, 1f);
         super(width, heigth);
         Gdx.gl.glClearColor(0f, .6f, .6f, 1f);
-        this.gameProc = gameProc;
+        this.gp = gp;
+    }
+
+    private float drawX(int x) {
+        return x * 16 - getCamX();
+    }
+
+    private float drawY(int y) {
+        return y * 16 - getCamY();
+    }
+
+    private void drawWreck() {
+        if (gp.blockDmg > 0) {
+            spriter.draw(Assets.wreck[
+                            10 * gp.blockDmg /
+                                    Items.blocks.getValueAt(gp.world.getForeMap(gp.curX, gp.curY)).getHp()],
+                    gp.curX * 16 - getCamX(),
+                    gp.curY * 16 - getCamY());
+        }
     }
 
     private void drawWorldBackground() {
     }
 
     private void drawWorldBackground() {
-        int minX = (int) (camera.position.x / 16) - 1;
-        int minY = (int) (camera.position.y / 16) - 1;
-        int maxX = (int) ((camera.position.x + camera.viewportWidth) / 16) + 1;
-        int maxY = (int) ((camera.position.y + camera.viewportHeight) / 16) + 1;
+        int minX = (int) (getCamX() / 16) - 1;
+        int minY = (int) (getCamY() / 16) - 1;
+        int maxX = (int) ((getCamX() + getWidth()) / 16) + 1;
+        int maxY = (int) ((getCamY() + getHeight()) / 16) + 1;
         if (minY < 0) minY = 0;
         if (minY < 0) minY = 0;
-        if (maxY > gameProc.world.getHeight()) maxY = gameProc.world.getHeight();
+        if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight();
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
-                if ((gameProc.world.getForeMap(x, y) == 0 || Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x, y)).transparent)
-                        && gameProc.world.getBackMap(x, y) > 0) {
-                    spriteBatch.draw(
-                            Assets.blockTextures[Items.BLOCKS.getValueAt(gameProc.world.getBackMap(x, y)).getTexture()],
-                            x * 16 - camera.position.x, y * 16 - camera.position.y);
-                    Assets.shade.setPosition(x * 16 - camera.position.x, y * 16 - camera.position.y);
-                    Assets.shade.draw(spriteBatch);
+                if ((gp.world.getForeMap(x, y) == 0 || Items.blocks.getValueAt(gp.world.getForeMap(x, y)).tp)
+                        && gp.world.getBackMap(x, y) > 0) {
+                    spriter.draw(
+                            Assets.blockTex[Items.blocks.getValueAt(gp.world.getBackMap(x, y)).getTex()],
+                            drawX(x), drawY(y));
+                    if (gp.world.getForeMap(x, y) == 0) drawWreck();
+                    Assets.shade.setPosition(drawX(x), drawY(y));
+                    Assets.shade.draw(spriter);
                 }
                 }
-                if (gameProc.world.getForeMap(x, y) > 0 && Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x, y)).background) {
-                    spriteBatch.draw(
-                            Assets.blockTextures[Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x, y)).getTexture()],
-                            x * 16 - camera.position.x, y * 16 - camera.position.y);
+                if (gp.world.getForeMap(x, y) > 0 && Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) {
+                    spriter.draw(
+                            Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()],
+                            drawX(x), drawY(y));
+                    drawWreck();
                 }
             }
         }
     }
 
     private void drawWorldForeground() {
                 }
             }
         }
     }
 
     private void drawWorldForeground() {
-        int minX = (int) (camera.position.x / 16) - 1;
-        int minY = (int) (camera.position.y / 16) - 1;
-        int maxX = (int) ((camera.position.x + camera.viewportWidth) / 16) + 1;
-        int maxY = (int) ((camera.position.y + camera.viewportHeight) / 16) + 1;
+        int minX = (int) (getCamX() / 16) - 1;
+        int minY = (int) (getCamY() / 16) - 1;
+        int maxX = (int) ((getCamX() + getWidth()) / 16) + 1;
+        int maxY = (int) ((getCamY() + getHeight()) / 16) + 1;
         if (minY < 0) minY = 0;
         if (minY < 0) minY = 0;
-        if (maxY > gameProc.world.getHeight()) maxY = gameProc.world.getHeight();
+        if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight();
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
         for (int y = minY; y < maxY; y++) {
             for (int x = minX; x < maxX; x++) {
-                if (gameProc.world.getForeMap(x, y) > 0 && !Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x, y)).background) {
-                    spriteBatch.draw(
-                            Assets.blockTextures[Items.BLOCKS.getValueAt(gameProc.world.getForeMap(x, y)).getTexture()],
-                            x * 16 - camera.position.x, y * 16 - camera.position.y);
+                if (gp.world.getForeMap(x, y) > 0 && !Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) {
+                    spriter.draw(
+                            Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()],
+                            drawX(x), drawY(y));
+                    drawWreck();
                 }
             }
         }
     }
 
     private void drawMob(Mob mob) {
                 }
             }
         }
     }
 
     private void drawMob(Mob mob) {
-        mob.draw(spriteBatch,
-                mob.position.x - camera.position.x - gameProc.world.getWidth() * 16, mob.position.y - camera.position.y);
-        mob.draw(spriteBatch,
-                mob.position.x - camera.position.x, mob.position.y - camera.position.y);
-        mob.draw(spriteBatch,
-                mob.position.x - camera.position.x + gameProc.world.getWidth() * 16, mob.position.y - camera.position.y);
+        mob.draw(spriter,
+                mob.position.x - getCamX() - gp.world.getWidth() * 16, mob.position.y - getCamY());
+        mob.draw(spriter,
+                mob.position.x - getCamX(), mob.position.y - getCamY());
+        mob.draw(spriter,
+                mob.position.x - getCamX() + gp.world.getWidth() * 16, mob.position.y - getCamY());
     }
 
     private void drawDrop(Drop drop) {
     }
 
     private void drawDrop(Drop drop) {
-        switch (Items.ITEMS.get(drop.getId()).getType()) {
+        switch (Items.items.get(drop.getId()).getType()) {
             case 0:
             case 0:
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].setPosition(drop.position.x - camera.position.x - gameProc.world.getWidth() * 16, drop.position.y - camera.position.y);
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].draw(spriteBatch);
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].setPosition(drop.position.x - camera.position.x, drop.position.y - camera.position.y);
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].draw(spriteBatch);
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].setPosition(drop.position.x - camera.position.x + gameProc.world.getWidth() * 16, drop.position.y - camera.position.y);
-                Assets.blockTextures[Items.ITEMS.get(drop.getId()).getTexture()].draw(spriteBatch);
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() - gp.world.getWidth() * 16, drop.position.y - getCamY());
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX(), drop.position.y - getCamY());
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() + gp.world.getWidth() * 16, drop.position.y - getCamY());
+                Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter);
         }
     }
 
     private void drawPlayer(Player pl) {
         }
     }
 
     private void drawPlayer(Player pl) {
-        if (pl.move.x != 0 || Assets.playerSprite[0][2].getRotation() != 0) {
-            Assets.playerSprite[0][2].rotate(Player.ANIM_SPEED);
-            Assets.playerSprite[1][2].rotate(-Player.ANIM_SPEED);
-            Assets.playerSprite[0][3].rotate(-Player.ANIM_SPEED);
-            Assets.playerSprite[1][3].rotate(Player.ANIM_SPEED);
+        if (pl.move.x != 0 || Assets.plSprite[0][2].getRotation() != 0) {
+            Assets.plSprite[0][2].rotate(Player.ANIM_SPEED);
+            Assets.plSprite[1][2].rotate(-Player.ANIM_SPEED);
+            Assets.plSprite[0][3].rotate(-Player.ANIM_SPEED);
+            Assets.plSprite[1][3].rotate(Player.ANIM_SPEED);
         } else {
         } else {
-            Assets.playerSprite[0][2].setRotation(0);
-            Assets.playerSprite[1][2].setRotation(0);
-            Assets.playerSprite[0][3].setRotation(0);
-            Assets.playerSprite[1][3].setRotation(0);
+            Assets.plSprite[0][2].setRotation(0);
+            Assets.plSprite[1][2].setRotation(0);
+            Assets.plSprite[0][3].setRotation(0);
+            Assets.plSprite[1][3].setRotation(0);
         }
         }
-        if (Assets.playerSprite[0][2].getRotation() >= 60 || Assets.playerSprite[0][2].getRotation() <= -60)
+        if (Assets.plSprite[0][2].getRotation() >= 60 || Assets.plSprite[0][2].getRotation() <= -60)
             Player.ANIM_SPEED = -Player.ANIM_SPEED;
 
         //back hand
             Player.ANIM_SPEED = -Player.ANIM_SPEED;
 
         //back hand
-        Assets.playerSprite[1][2].setPosition(
-                pl.position.x - camera.position.x - 6,
-                pl.position.y - camera.position.y);
-        Assets.playerSprite[1][2].draw(spriteBatch);
+        Assets.plSprite[1][2].setPosition(
+                pl.position.x - getCamX() - 6,
+                pl.position.y - getCamY());
+        Assets.plSprite[1][2].draw(spriter);
         //back leg
         //back leg
-        Assets.playerSprite[1][3].setPosition(
-                pl.position.x - camera.position.x - 6,
-                pl.position.y - camera.position.y + 10);
-        Assets.playerSprite[1][3].draw(spriteBatch);
+        Assets.plSprite[1][3].setPosition(
+                pl.position.x - getCamX() - 6,
+                pl.position.y - getCamY() + 10);
+        Assets.plSprite[1][3].draw(spriter);
         //front leg
         //front leg
-        Assets.playerSprite[0][3].setPosition(
-                pl.position.x - camera.position.x - 6,
-                pl.position.y - camera.position.y + 10);
-        Assets.playerSprite[0][3].draw(spriteBatch);
+        Assets.plSprite[0][3].setPosition(
+                pl.position.x - getCamX() - 6,
+                pl.position.y - getCamY() + 10);
+        Assets.plSprite[0][3].draw(spriter);
         //head
         //head
-        spriteBatch.draw(Assets.playerSprite[pl.dir][0],
-                pl.position.x - camera.position.x - 2,
-                pl.position.y - camera.position.y - 2);
+        spriter.draw(Assets.plSprite[pl.dir][0],
+                pl.position.x - getCamX() - 2,
+                pl.position.y - getCamY() - 2);
         //body
         //body
-        spriteBatch.draw(Assets.playerSprite[pl.dir][1],
-                pl.position.x - camera.position.x - 2, pl.position.y - camera.position.y + 8);
+        spriter.draw(Assets.plSprite[pl.dir][1],
+                pl.position.x - getCamX() - 2, pl.position.y - getCamY() + 8);
         //item in hand
         //item in hand
-        if (pl.inventory[gameProc.invSlot] > 0)
-            switch (Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getType()) {
+        if (pl.inventory[gp.invSlot] > 0)
+            switch (Items.items.get(pl.inventory[gp.invSlot]).getType()) {
                 case 0:
                 case 0:
-                    Assets.blockTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].setPosition(
-                            pl.position.x - camera.position.x - 8 * MathUtils.sin(MathUtils.degRad * Assets.playerSprite[0][2].getRotation()),
-                            pl.position.y - camera.position.y + 6 + 8 * MathUtils.cos(MathUtils.degRad * Assets.playerSprite[0][2].getRotation()));
-                    Assets.blockTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].draw(spriteBatch);
+                    Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition(
+                            pl.position.x - getCamX() - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()),
+                            pl.position.y - getCamY() + 6 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation()));
+                    Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
                     break;
                 default:
                     break;
                 default:
-                    Assets.itemTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].flip((pl.dir == 0), false);
-                    Assets.itemTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].setRotation(
-                            -45 + pl.dir * 90 + Assets.playerSprite[0][2].getRotation());
-                    Assets.itemTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].setPosition(
-                            pl.position.x - camera.position.x - 10 + (12 * pl.dir) - 8 * MathUtils.sin(MathUtils.degRad * Assets.playerSprite[0][2].getRotation()),
-                            pl.position.y - camera.position.y + 2 + 8 * MathUtils.cos(MathUtils.degRad * Assets.playerSprite[0][2].getRotation()));
-                    Assets.itemTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].draw(spriteBatch);
-                    Assets.itemTextures[Items.ITEMS.get(pl.inventory[gameProc.invSlot]).getTexture()].flip((pl.dir == 0), false);
+                    Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
+                    Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setRotation(
+                            -45 + pl.dir * 90 + Assets.plSprite[0][2].getRotation());
+                    Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition(
+                            pl.position.x - getCamX() - 10 + (12 * pl.dir) - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()),
+                            pl.position.y - getCamY() + 2 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation()));
+                    Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter);
+                    Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false);
                     break;
             }
         //front hand
                     break;
             }
         //front hand
-        Assets.playerSprite[0][2].setPosition(
-                pl.position.x - camera.position.x - 6,
-                pl.position.y - camera.position.y);
-        Assets.playerSprite[0][2].draw(spriteBatch);
+        Assets.plSprite[0][2].setPosition(
+                pl.position.x - getCamX() - 6,
+                pl.position.y - getCamY());
+        Assets.plSprite[0][2].draw(spriter);
     }
 
     private void drawCreative() {
     }
 
     private void drawCreative() {
-        float x = camera.viewportWidth / 2 - Assets.creativeInv.getRegionWidth() / 2;
-        float y = camera.viewportHeight / 2 - Assets.creativeInv.getRegionHeight() / 2;
-        spriteBatch.draw(Assets.creativeInv, x, y);
-        spriteBatch.draw(Assets.creativeScroll, x + 156,
-                y + 18 + (gameProc.creativeScroll * (72 / gameProc.maxCreativeScroll)));
-        for (int i = gameProc.creativeScroll * 8; i < gameProc.creativeScroll * 8 + 40; i++) {
-            if (i > 0 && i < Items.ITEMS.size())
-                switch (Items.ITEMS.get(i).getType()) {
+        float x = getWidth() / 2 - Assets.creativeInv.getRegionWidth() / 2;
+        float y = getHeight() / 2 - Assets.creativeInv.getRegionHeight() / 2;
+        spriter.draw(Assets.creativeInv, x, y);
+        spriter.draw(Assets.creativeScr, x + 156,
+                y + 18 + (gp.creativeScroll * (72 / gp.maxCreativeScroll)));
+        for (int i = gp.creativeScroll * 8; i < gp.creativeScroll * 8 + 40; i++) {
+            if (i > 0 && i < Items.items.size())
+                switch (Items.items.get(i).getType()) {
                     case 0:
                     case 0:
-                        spriteBatch.draw(Assets.blockTextures[Items.ITEMS.get(i).getTexture()],
-                                x + 8 + ((i - gameProc.creativeScroll * 8) % 8) * 18,
-                                y + 18 + ((i - gameProc.creativeScroll * 8) / 8) * 18);
+                        spriter.draw(Assets.blockTex[Items.items.get(i).getTex()],
+                                x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18,
+                                y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18);
                         break;
                     case 1:
                         break;
                     case 1:
-                        spriteBatch.draw(Assets.itemTextures[Items.ITEMS.get(i).getTexture()],
-                                x + 8 + ((i - gameProc.creativeScroll * 8) % 8) * 18,
-                                y + 18 + ((i - gameProc.creativeScroll * 8) / 8) * 18);
+                        spriter.draw(Assets.itemTex[Items.items.get(i).getTex()],
+                                x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18,
+                                y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18);
                         break;
                 }
         }
         for (int i = 0; i < 9; i++) {
                         break;
                 }
         }
         for (int i = 0; i < 9; i++) {
-            if (gameProc.player.inventory[i] > 0)
-                switch (Items.ITEMS.get(gameProc.player.inventory[i]).getType()) {
+            if (gp.player.inventory[i] > 0)
+                switch (Items.items.get(gp.player.inventory[i]).getType()) {
                     case 0:
                     case 0:
-                        spriteBatch.draw(Assets.blockTextures[Items.ITEMS.get(gameProc.player.inventory[i]).getTexture()],
+                        spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()],
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
                     case 1:
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
                     case 1:
-                        spriteBatch.draw(Assets.itemTextures[Items.ITEMS.get(gameProc.player.inventory[i]).getTexture()],
+                        spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()],
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
                 }
                                 x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24);
                         break;
                 }
@@ -188,61 +208,54 @@ public class GameRenderer extends Renderer {
     }
 
     private void drawGUI() {
     }
 
     private void drawGUI() {
-        if (gameProc.blockDmg > 0) {
-            spriteBatch.draw(Assets.wreck[
-                            10 * gameProc.blockDmg /
-                                    Items.BLOCKS.getValueAt(gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY)).getHp()],
-                    gameProc.cursorX * 16 - camera.position.x,
-                    gameProc.cursorY * 16 - camera.position.y);
-        }
-        if (gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY) > 0 ||
-                gameProc.world.getBackMap(gameProc.cursorX, gameProc.cursorY) > 0 ||
-                gameProc.ctrlMode == 1 ||
+        if (gp.world.getForeMap(gp.curX, gp.curY) > 0 ||
+                gp.world.getBackMap(gp.curX, gp.curY) > 0 ||
+                gp.ctrlMode == 1 ||
                 !CaveGame.TOUCH)
                 !CaveGame.TOUCH)
-            spriteBatch.draw(Assets.guiCur,
-                    gameProc.cursorX * 16 - camera.position.x,
-                    gameProc.cursorY * 16 - camera.position.y);
-        spriteBatch.draw(Assets.invBar, camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2, 0);
+            spriter.draw(Assets.guiCur,
+                    gp.curX * 16 - getCamX(),
+                    gp.curY * 16 - getCamY());
+        spriter.draw(Assets.invBar, getWidth() / 2 - Assets.invBar.getRegionWidth() / 2, 0);
         for (int i = 0; i < 9; i++) {
         for (int i = 0; i < 9; i++) {
-            if (gameProc.player.inventory[i] > 0) {
-                switch (Items.ITEMS.get(gameProc.player.inventory[i]).getType()) {
+            if (gp.player.inventory[i] > 0) {
+                switch (Items.items.get(gp.player.inventory[i]).getType()) {
                     case 0:
                     case 0:
-                        spriteBatch.draw(Assets.blockTextures[Items.ITEMS.get(gameProc.player.inventory[i]).getTexture()],
-                                camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
+                        spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()],
+                                getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
                                 3);
                         break;
                     case 1:
                                 3);
                         break;
                     case 1:
-                        spriteBatch.draw(Assets.itemTextures[Items.ITEMS.get(gameProc.player.inventory[i]).getTexture()],
-                                camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
+                        spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()],
+                                getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20,
                                 3);
                         break;
                 }
             }
         }
                                 3);
                         break;
                 }
             }
         }
-        spriteBatch.draw(Assets.invBarCur,
-                camera.viewportWidth / 2 - Assets.invBar.getRegionWidth() / 2 - 1 + 20 * gameProc.invSlot,
+        spriter.draw(Assets.invBarCur,
+                getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 - 1 + 20 * gp.invSlot,
                 -1);
     }
 
     private void drawTouchGui() {
                 -1);
     }
 
     private void drawTouchGui() {
-        spriteBatch.draw(Assets.touchArrows[0], 26, camera.viewportHeight - 52);
-        spriteBatch.draw(Assets.touchArrows[1], 0, camera.viewportHeight - 26);
-        spriteBatch.draw(Assets.touchArrows[2], 26, camera.viewportHeight - 26);
-        spriteBatch.draw(Assets.touchArrows[3], 52, camera.viewportHeight - 26);
-        spriteBatch.draw(Assets.touchLMB, camera.viewportWidth - 52, camera.viewportHeight - 26);
-        spriteBatch.draw(Assets.touchRMB, camera.viewportWidth - 26, camera.viewportHeight - 26);
-        spriteBatch.draw(Assets.touchToggleMode, 78, camera.viewportHeight - 26);
-        if (gameProc.ctrlMode == 1) {
-            Assets.shade.setPosition(83, camera.viewportHeight - 21);
-            Assets.shade.draw(spriteBatch);
+        spriter.draw(Assets.touchArrows[0], 26, getHeight() - 52);
+        spriter.draw(Assets.touchArrows[1], 0, getHeight() - 26);
+        spriter.draw(Assets.touchArrows[2], 26, getHeight() - 26);
+        spriter.draw(Assets.touchArrows[3], 52, getHeight() - 26);
+        spriter.draw(Assets.touchLMB, getWidth() - 52, getHeight() - 26);
+        spriter.draw(Assets.touchRMB, getWidth() - 26, getHeight() - 26);
+        spriter.draw(Assets.touchMode, 78, getHeight() - 26);
+        if (gp.ctrlMode == 1) {
+            Assets.shade.setPosition(83, getHeight() - 21);
+            Assets.shade.draw(spriter);
         }
     }
 
     private void drawGamePlay() {
         drawWorldBackground();
         }
     }
 
     private void drawGamePlay() {
         drawWorldBackground();
-        drawPlayer(gameProc.player);
-        for (Mob mob : gameProc.mobs) drawMob(mob);
-        for (Drop drop : gameProc.drops) drawDrop(drop);
+        drawPlayer(gp.player);
+        for (Mob mob : gp.mobs) drawMob(mob);
+        for (Drop drop : gp.drops) drawDrop(drop);
         drawWorldForeground();
         drawGUI();
     }
         drawWorldForeground();
         drawGUI();
     }
@@ -251,7 +264,7 @@ public class GameRenderer extends Renderer {
     public void render() {
         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 
     public void render() {
         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 
-        spriteBatch.begin();
+        spriter.begin();
         switch (CaveGame.STATE) {
             case GAME_PLAY:
                 drawGamePlay();
         switch (CaveGame.STATE) {
             case GAME_PLAY:
                 drawGamePlay();
@@ -266,14 +279,14 @@ public class GameRenderer extends Renderer {
 
         if (GameScreen.SHOW_DEBUG) {
             drawString("FPS: " + GameScreen.FPS, 0, 0);
 
         if (GameScreen.SHOW_DEBUG) {
             drawString("FPS: " + GameScreen.FPS, 0, 0);
-            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("Drops: " + gameProc.drops.size(), 0, 40);
-            drawString("Block: " + Items.BLOCKS.getKeyAt(gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY)), 0, 50);
+            drawString("X: " + (int) (gp.player.position.x / 16), 0, 10);
+            drawString("Y: " + (int) (gp.player.position.y / 16), 0, 20);
+            drawString("Mobs: " + gp.mobs.size(), 0, 30);
+            drawString("Drops: " + gp.drops.size(), 0, 40);
+            drawString("Block: " + Items.blocks.getKeyAt(gp.world.getForeMap(gp.curX, gp.curY)), 0, 50);
         }
 
         }
 
-        spriteBatch.end();
+        spriter.end();
     }
 
 }
     }
 
 }
index a4e314b465273705b1cc404d44918080ef0b7f26..c4e13a640a737ec58b8bf1a1a9bb6c425a42c2c5 100644 (file)
@@ -87,17 +87,17 @@ public class GameSaver {
         return gameProc;
     }
 
         return gameProc;
     }
 
-    public static void save(GameProc gameProc) {
+    public static void save(GameProc gp) {
         FileHandle file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/");
         file.mkdirs();
         file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav");
         try {
             ObjectOutputStream out = new ObjectOutputStream(file.write(false));
             out.writeInt(VERSION);
         FileHandle file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/");
         file.mkdirs();
         file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav");
         try {
             ObjectOutputStream out = new ObjectOutputStream(file.write(false));
             out.writeInt(VERSION);
-            out.writeObject(gameProc);
+            out.writeObject(gp);
             out.close();
             out.close();
-            saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav"), gameProc.world.getFullForeMap());
-            saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"), gameProc.world.getFullBackMap());
+            saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav"), gp.world.getFullForeMap());
+            saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"), gp.world.getFullBackMap());
         } catch (Exception e) {
             e.printStackTrace();
         }
         } catch (Exception e) {
             e.printStackTrace();
         }
index 62f7274a85a1caead1664626cb3c46b1c42b25a0..6adac2d5ad1f7bd47b873f25ad832bdd3c927c8a 100644 (file)
@@ -94,7 +94,7 @@ public class GameWorld {
     }
 
     public void placeToForeground(int x, int y, int value) {
     }
 
     public void placeToForeground(int x, int y, int value) {
-        if (getForeMap(x, y) == 0 || value == 0 || !Items.BLOCKS.getValueAt(getForeMap(x, y)).collision) {
+        if (getForeMap(x, y) == 0 || value == 0 || !Items.blocks.getValueAt(getForeMap(x, y)).coll) {
             setForeMap(x, y, value);
         } else if (Items.isSlab(value) && getForeMap(x, y) == value) {
             placeSlab(x, y, value);
             setForeMap(x, y, value);
         } else if (Items.isSlab(value) && getForeMap(x, y) == value) {
             placeSlab(x, y, value);
@@ -105,8 +105,8 @@ public class GameWorld {
     }
 
     public void placeToBackground(int x, int y, int value) {
     }
 
     public void placeToBackground(int x, int y, int value) {
-        if (value == 0 || (getBackMap(x, y) == 0 && Items.BLOCKS.getValueAt(value).collision) &&
-                (!Items.BLOCKS.getValueAt(value).transparent || value == 18)) {
+        if (value == 0 || (getBackMap(x, y) == 0 && Items.blocks.getValueAt(value).coll) &&
+                (!Items.blocks.getValueAt(value).tp || value == 18)) {
             setBackMap(x, y, value);
         }
     }
             setBackMap(x, y, value);
         }
     }
@@ -115,7 +115,7 @@ public class GameWorld {
         int x = 0, y = 0;
         while (true) {
             y++;
         int x = 0, y = 0;
         while (true) {
             y++;
-            if (getForeMap(x, y) > 0 && Items.BLOCKS.getValueAt(getForeMap(x, y)).collision) break;
+            if (getForeMap(x, y) > 0 && Items.blocks.getValueAt(getForeMap(x, y)).coll) break;
         }
         x = x * 16 + 4;
         y = y * 16 - 32;
         }
         x = x * 16 + 4;
         y = y * 16 - 32;
index 2121ae08aa41db2abae2610cbcfc87ffb147eaaf..2853b7b597ecf24b881ee210df3bdb5f66fb68e9 100644 (file)
@@ -8,8 +8,8 @@ import java.util.ArrayList;
 
 public class Items {
 
 
 public class Items {
 
-    public static ArrayMap<String, Block> BLOCKS = new ArrayMap<String, Block>();
-    public static ArrayList<Item> ITEMS = new ArrayList<Item>();
+    public static ArrayMap<String, Block> blocks = new ArrayMap<String, Block>();
+    public static ArrayList<Item> items = new ArrayList<Item>();
 
     public static boolean isFluid(int bl) {
         return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65 || bl == 66 || bl == 67);
 
     public static boolean isFluid(int bl) {
         return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65 || bl == 66 || bl == 67);
@@ -29,275 +29,275 @@ public class Items {
 
     public static void loadItems() {
         //0
 
     public static void loadItems() {
         //0
-        ITEMS.add(null);
+        items.add(null);
         //1
         //1
-        ITEMS.add(new Item("Stone", 0, 0, 1));
+        items.add(new Item("Stone", 0, 0, 1));
         //2
         //2
-        ITEMS.add(new Item("Grass", 1, 0, 2));
+        items.add(new Item("Grass", 1, 0, 2));
         //3
         //3
-        ITEMS.add(new Item("Dirt", 2, 0, 3));
+        items.add(new Item("Dirt", 2, 0, 3));
         //4
         //4
-        ITEMS.add(new Item("Cobblestone", 3, 0, 4));
+        items.add(new Item("Cobblestone", 3, 0, 4));
         //5
         //5
-        ITEMS.add(new Item("Planks", 4, 0, 5));
+        items.add(new Item("Planks", 4, 0, 5));
         //6
         //6
-        ITEMS.add(new Item("Sapling", 5, 0, 6));
+        items.add(new Item("Sapling", 5, 0, 6));
         //7
         //7
-        ITEMS.add(new Item("Bedrock", 6, 0, 7));
+        items.add(new Item("Bedrock", 6, 0, 7));
         //8
         //8
-        ITEMS.add(new Item("Sand", 9, 0, 10));
+        items.add(new Item("Sand", 9, 0, 10));
         //9
         //9
-        ITEMS.add(new Item("Gravel", 10, 0, 11));
+        items.add(new Item("Gravel", 10, 0, 11));
         //10
         //10
-        ITEMS.add(new Item("Golden Ore", 11, 0, 12));
+        items.add(new Item("Golden Ore", 11, 0, 12));
         //11
         //11
-        ITEMS.add(new Item("Iron Ore", 12, 0, 13));
+        items.add(new Item("Iron Ore", 12, 0, 13));
         //12
         //12
-        ITEMS.add(new Item("Coal Ore", 13, 0, 14));
+        items.add(new Item("Coal Ore", 13, 0, 14));
         //13
         //13
-        ITEMS.add(new Item("Wood", 14, 0, 15));
+        items.add(new Item("Wood", 14, 0, 15));
         //14
         //14
-        ITEMS.add(new Item("Leaves", 15, 0, 16));
+        items.add(new Item("Leaves", 15, 0, 16));
         //15
         //15
-        ITEMS.add(new Item("Glass", 17, 0, 18));
+        items.add(new Item("Glass", 17, 0, 18));
         //16
         //16
-        ITEMS.add(new Item("Lapis Ore", 18, 0, 19));
+        items.add(new Item("Lapis Ore", 18, 0, 19));
         //17
         //17
-        ITEMS.add(new Item("Lapis Block", 19, 0, 20));
+        items.add(new Item("Lapis Block", 19, 0, 20));
         //18
         //18
-        ITEMS.add(new Item("Sandstone", 20, 0, 21));
+        items.add(new Item("Sandstone", 20, 0, 21));
         //19
         //19
-        ITEMS.add(new Item("Cobweb", 24, 0, 25));
+        items.add(new Item("Cobweb", 24, 0, 25));
         //20
         //20
-        ITEMS.add(new Item("Tall Grass", 25, 0, 26));
+        items.add(new Item("Tall Grass", 25, 0, 26));
         //21
         //21
-        ITEMS.add(new Item("Dead Bush", 26, 0, 27));
+        items.add(new Item("Dead Bush", 26, 0, 27));
         //22
         //22
-        ITEMS.add(new Item("Bricks", 27, 0, 28));
+        items.add(new Item("Bricks", 27, 0, 28));
         //23
         //23
-        ITEMS.add(new Item("Dandelion", 28, 0, 29));
+        items.add(new Item("Dandelion", 28, 0, 29));
         //24
         //24
-        ITEMS.add(new Item("Rose", 29, 0, 30));
+        items.add(new Item("Rose", 29, 0, 30));
         //25
         //25
-        ITEMS.add(new Item("Mushroom", 30, 0, 31));
+        items.add(new Item("Mushroom", 30, 0, 31));
         //26
         //26
-        ITEMS.add(new Item("Mushroom", 31, 0, 32));
+        items.add(new Item("Mushroom", 31, 0, 32));
         //27
         //27
-        ITEMS.add(new Item("White Wool", 32, 0, 33));
+        items.add(new Item("White Wool", 32, 0, 33));
         //28
         //28
-        ITEMS.add(new Item("Orange Wool", 33, 0, 34));
+        items.add(new Item("Orange Wool", 33, 0, 34));
         //29
         //29
-        ITEMS.add(new Item("Magenta Wool", 34, 0, 35));
+        items.add(new Item("Magenta Wool", 34, 0, 35));
         //30
         //30
-        ITEMS.add(new Item("Light Blue Wool", 35, 0, 36));
+        items.add(new Item("Light Blue Wool", 35, 0, 36));
         //31
         //31
-        ITEMS.add(new Item("Yellow Wool", 36, 0, 37));
+        items.add(new Item("Yellow Wool", 36, 0, 37));
         //32
         //32
-        ITEMS.add(new Item("Lime Wool", 37, 0, 38));
+        items.add(new Item("Lime Wool", 37, 0, 38));
         //33
         //33
-        ITEMS.add(new Item("Pink Wool", 38, 0, 39));
+        items.add(new Item("Pink Wool", 38, 0, 39));
         //34
         //34
-        ITEMS.add(new Item("Gray Wool", 39, 0, 40));
+        items.add(new Item("Gray Wool", 39, 0, 40));
         //35
         //35
-        ITEMS.add(new Item("Light Gray Wool", 40, 0, 41));
+        items.add(new Item("Light Gray Wool", 40, 0, 41));
         //36
         //36
-        ITEMS.add(new Item("Cyan Wool", 41, 0, 42));
+        items.add(new Item("Cyan Wool", 41, 0, 42));
         //37
         //37
-        ITEMS.add(new Item("Purple Wool", 42, 0, 43));
+        items.add(new Item("Purple Wool", 42, 0, 43));
         //38
         //38
-        ITEMS.add(new Item("Blue Wool", 43, 0, 44));
+        items.add(new Item("Blue Wool", 43, 0, 44));
         //39
         //39
-        ITEMS.add(new Item("Brown Wool", 44, 0, 45));
+        items.add(new Item("Brown Wool", 44, 0, 45));
         //40
         //40
-        ITEMS.add(new Item("Green Wool", 45, 0, 46));
+        items.add(new Item("Green Wool", 45, 0, 46));
         //41
         //41
-        ITEMS.add(new Item("Red Wool", 46, 0, 47));
+        items.add(new Item("Red Wool", 46, 0, 47));
         //42
         //42
-        ITEMS.add(new Item("Black Wool", 47, 0, 48));
+        items.add(new Item("Black Wool", 47, 0, 48));
         //43
         //43
-        ITEMS.add(new Item("Golden Block", 48, 0, 49));
+        items.add(new Item("Golden Block", 48, 0, 49));
         //44
         //44
-        ITEMS.add(new Item("Iron Block", 49, 0, 50));
+        items.add(new Item("Iron Block", 49, 0, 50));
         //45
         //45
-        ITEMS.add(new Item("Stone Slab", 50, 0, 51));
+        items.add(new Item("Stone Slab", 50, 0, 51));
         //46
         //46
-        ITEMS.add(new Item("Sandstone Slab", 52, 0, 53));
+        items.add(new Item("Sandstone Slab", 52, 0, 53));
         //47
         //47
-        ITEMS.add(new Item("Wooden Slab", 53, 0, 54));
+        items.add(new Item("Wooden Slab", 53, 0, 54));
         //48
         //48
-        ITEMS.add(new Item("Cobblestone Slab", 54, 0, 55));
+        items.add(new Item("Cobblestone Slab", 54, 0, 55));
         //49
         //49
-        ITEMS.add(new Item("Brick Slab", 55, 0, 56));
+        items.add(new Item("Brick Slab", 55, 0, 56));
         //50
         //50
-        ITEMS.add(new Item("Stone Brick", 64, 0, 57));
+        items.add(new Item("Stone Brick", 64, 0, 57));
         //51
         //51
-        ITEMS.add(new Item("Stone Brick Slab", 56, 0, 58));
+        items.add(new Item("Stone Brick Slab", 56, 0, 58));
         //52
         //52
-        ITEMS.add(new Item("Cactus", 57, 0, 59));
+        items.add(new Item("Cactus", 57, 0, 59));
         //53
         //53
-        ITEMS.add(new Item("Obsidian", 65, 0, 68));
+        items.add(new Item("Obsidian", 65, 0, 68));
         //54
         //54
-        ITEMS.add(new Item("Wooden Sword", 0, 1));
+        items.add(new Item("Wooden Sword", 0, 1));
         //55
         //55
-        ITEMS.add(new Item("Stone Sword", 1, 1));
+        items.add(new Item("Stone Sword", 1, 1));
         //56
         //56
-        ITEMS.add(new Item("Iron Sword", 2, 1));
+        items.add(new Item("Iron Sword", 2, 1));
         //57
         //57
-        ITEMS.add(new Item("Diamond Sword", 3, 1));
+        items.add(new Item("Diamond Sword", 3, 1));
         //58
         //58
-        ITEMS.add(new Item("Golden Sword", 4, 1));
+        items.add(new Item("Golden Sword", 4, 1));
         //59
         //59
-        ITEMS.add(new Item("Wooden Shovel", 5, 1));
+        items.add(new Item("Wooden Shovel", 5, 1));
         //60
         //60
-        ITEMS.add(new Item("Stone Shovel", 6, 1));
+        items.add(new Item("Stone Shovel", 6, 1));
         //61
         //61
-        ITEMS.add(new Item("Iron Shovel", 7, 1));
+        items.add(new Item("Iron Shovel", 7, 1));
         //62
         //62
-        ITEMS.add(new Item("Diamond Shovel", 8, 1));
+        items.add(new Item("Diamond Shovel", 8, 1));
         //63
         //63
-        ITEMS.add(new Item("Golden Shovel", 9, 1));
+        items.add(new Item("Golden Shovel", 9, 1));
 
     }
 
     public static void loadBlocks() {
         //0
 
     }
 
     public static void loadBlocks() {
         //0
-        BLOCKS.put("none", null);
+        blocks.put("none", null);
         //1
         //1
-        BLOCKS.put("stone", new Block(0, 450, 4));
+        blocks.put("stone", new Block(0, 450, 4));
         //2
         //2
-        BLOCKS.put("grass", new Block(1, 54, 3));
+        blocks.put("grass", new Block(1, 54, 3));
         //3
         //3
-        BLOCKS.put("dirt", new Block(2, 45, 3));
+        blocks.put("dirt", new Block(2, 45, 3));
         //4
         //4
-        BLOCKS.put("cobblestone", new Block(3, 600, 4));
+        blocks.put("cobblestone", new Block(3, 600, 4));
         //5
         //5
-        BLOCKS.put("planks", new Block(4, 180, 5));
+        blocks.put("planks", new Block(4, 180, 5));
         //6
         //6
-        BLOCKS.put("sapling", new Block(5, 0, 6, false, false, true));
+        blocks.put("sapling", new Block(5, 0, 6, false, false, true));
         //7
         //7
-        BLOCKS.put("bedrock", new Block(6, -1, 7));
+        blocks.put("bedrock", new Block(6, -1, 7));
         //8
         //8
-        BLOCKS.put("water", new Block(7, -1, 0, false, false, true));
+        blocks.put("water", new Block(7, -1, 0, false, false, true));
         //9
         //9
-        BLOCKS.put("lava", new Block(8, -1, 0, false, false, false));
+        blocks.put("lava", new Block(8, -1, 0, false, false, false));
         //10
         //10
-        BLOCKS.put("sand", new Block(9, 45, 8));
+        blocks.put("sand", new Block(9, 45, 8));
         //11
         //11
-        BLOCKS.put("gravel", new Block(10, 54, 9));
+        blocks.put("gravel", new Block(10, 54, 9));
         //12
         //12
-        BLOCKS.put("gold_ore", new Block(11, 900, 10));
+        blocks.put("gold_ore", new Block(11, 900, 10));
         //13
         //13
-        BLOCKS.put("iron_ore", new Block(12, 900, 11));
+        blocks.put("iron_ore", new Block(12, 900, 11));
         //14
         //14
-        BLOCKS.put("coal_ore", new Block(13, 900, 0));
+        blocks.put("coal_ore", new Block(13, 900, 0));
         //15
         //15
-        BLOCKS.put("log", new Block(14, 180, 13));
+        blocks.put("log", new Block(14, 180, 13));
         //16
         //16
-        BLOCKS.put("leaves", new Block(15, 21, 0));
+        blocks.put("leaves", new Block(15, 21, 0));
         //17
         //17
-        BLOCKS.put("sponge", new Block(16, 54, 0));
+        blocks.put("sponge", new Block(16, 54, 0));
         //18
         //18
-        BLOCKS.put("glass", new Block(17, 27, 0, true, false, true));
+        blocks.put("glass", new Block(17, 27, 0, true, false, true));
         //19
         //19
-        BLOCKS.put("lapis_ore", new Block(18, 900, 0));
+        blocks.put("lapis_ore", new Block(18, 900, 0));
         //20
         //20
-        BLOCKS.put("lapis_block", new Block(19, 900, 17));
+        blocks.put("lapis_block", new Block(19, 900, 17));
         //21
         //21
-        BLOCKS.put("sandstone", new Block(20, 240, 18));
+        blocks.put("sandstone", new Block(20, 240, 18));
         //22
         //22
-        BLOCKS.put("noteblock", new Block(21, 75, 0));
+        blocks.put("noteblock", new Block(21, 75, 0));
         //23
         //23
-        BLOCKS.put("bed_l", new Block(22, 21, 0, false, true, true));
+        blocks.put("bed_l", new Block(22, 21, 0, false, true, true));
         //24
         //24
-        BLOCKS.put("bed_r", new Block(23, 21, 0, false, true, true));
+        blocks.put("bed_r", new Block(23, 21, 0, false, true, true));
         //25
         //25
-        BLOCKS.put("cobweb", new Block(24, 1200, 0, false, false, true));
+        blocks.put("cobweb", new Block(24, 1200, 0, false, false, true));
         //26
         //26
-        BLOCKS.put("tallgrass", new Block(25, 0, 0, false, false, true));
+        blocks.put("tallgrass", new Block(25, 0, 0, false, false, true));
         //27
         //27
-        BLOCKS.put("deadbush", new Block(26, 0, 0, false, false, true));
+        blocks.put("deadbush", new Block(26, 0, 0, false, false, true));
         //28
         //28
-        BLOCKS.put("brick_block", new Block(27, 600, 22));
+        blocks.put("brick_block", new Block(27, 600, 22));
         //29
         //29
-        BLOCKS.put("dandelion", new Block(28, 0, 23, false, false, true));
+        blocks.put("dandelion", new Block(28, 0, 23, false, false, true));
         //30
         //30
-        BLOCKS.put("rose", new Block(29, 0, 24, false, false, true));
+        blocks.put("rose", new Block(29, 0, 24, false, false, true));
         //31
         //31
-        BLOCKS.put("brown_mushroom", new Block(30, 0, 25, false, false, true));
+        blocks.put("brown_mushroom", new Block(30, 0, 25, false, false, true));
         //32
         //32
-        BLOCKS.put("red_mushroom", new Block(31, 0, 26, false, false, true));
+        blocks.put("red_mushroom", new Block(31, 0, 26, false, false, true));
         //33
         //33
-        BLOCKS.put("wool_while", new Block(32, 75, 27, true, false, false));
+        blocks.put("wool_while", new Block(32, 75, 27, true, false, false));
         //34
         //34
-        BLOCKS.put("wool_orange", new Block(33, 75, 28, true, false, false));
+        blocks.put("wool_orange", new Block(33, 75, 28, true, false, false));
         //35
         //35
-        BLOCKS.put("wool_magenta", new Block(34, 75, 29, true, false, false));
+        blocks.put("wool_magenta", new Block(34, 75, 29, true, false, false));
         //36
         //36
-        BLOCKS.put("wool_lightblue", new Block(35, 75, 30, true, false, false));
+        blocks.put("wool_lightblue", new Block(35, 75, 30, true, false, false));
         //37
         //37
-        BLOCKS.put("wool_yellow", new Block(36, 75, 31, true, false, false));
+        blocks.put("wool_yellow", new Block(36, 75, 31, true, false, false));
         //38
         //38
-        BLOCKS.put("wool_lime", new Block(37, 75, 32, true, false, false));
+        blocks.put("wool_lime", new Block(37, 75, 32, true, false, false));
         //39
         //39
-        BLOCKS.put("wool_pink", new Block(38, 75, 33, true, false, false));
+        blocks.put("wool_pink", new Block(38, 75, 33, true, false, false));
         //40
         //40
-        BLOCKS.put("wool_gray", new Block(39, 75, 34, true, false, false));
+        blocks.put("wool_gray", new Block(39, 75, 34, true, false, false));
         //41
         //41
-        BLOCKS.put("wool_lightgray", new Block(40, 75, 35, true, false, false));
+        blocks.put("wool_lightgray", new Block(40, 75, 35, true, false, false));
         //42
         //42
-        BLOCKS.put("wool_cyan", new Block(41, 75, 36, true, false, false));
+        blocks.put("wool_cyan", new Block(41, 75, 36, true, false, false));
         //43
         //43
-        BLOCKS.put("wool_purple", new Block(42, 75, 37, true, false, false));
+        blocks.put("wool_purple", new Block(42, 75, 37, true, false, false));
         //44
         //44
-        BLOCKS.put("wool_blue", new Block(43, 75, 38, true, false, false));
+        blocks.put("wool_blue", new Block(43, 75, 38, true, false, false));
         //45
         //45
-        BLOCKS.put("wool_brown", new Block(44, 75, 39, true, false, false));
+        blocks.put("wool_brown", new Block(44, 75, 39, true, false, false));
         //46
         //46
-        BLOCKS.put("wool_green", new Block(45, 75, 40, true, false, false));
+        blocks.put("wool_green", new Block(45, 75, 40, true, false, false));
         //47
         //47
-        BLOCKS.put("wool_red", new Block(46, 75, 41, true, false, false));
+        blocks.put("wool_red", new Block(46, 75, 41, true, false, false));
         //48
         //48
-        BLOCKS.put("wool_black", new Block(47, 75, 42, true, false, false));
+        blocks.put("wool_black", new Block(47, 75, 42, true, false, false));
         //49
         //49
-        BLOCKS.put("gold_block", new Block(48, 900, 43));
+        blocks.put("gold_block", new Block(48, 900, 43));
         //50
         //50
-        BLOCKS.put("iron_block", new Block(49, 1500, 44));
+        blocks.put("iron_block", new Block(49, 1500, 44));
         //51
         //51
-        BLOCKS.put("stone_slab", new Block(0, 8, 16, 8, 50, 600, 45, true, false, true));
+        blocks.put("stone_slab", new Block(0, 8, 16, 8, 50, 600, 45, true, false, true));
         //52
         //52
-        BLOCKS.put("double_stone_slab", new Block(51, 600, 45));
+        blocks.put("double_stone_slab", new Block(51, 600, 45));
         //53
         //53
-        BLOCKS.put("sandstone_slab", new Block(0, 8, 16, 8, 52, 600, 46, true, false, true));
+        blocks.put("sandstone_slab", new Block(0, 8, 16, 8, 52, 600, 46, true, false, true));
         //54
         //54
-        BLOCKS.put("wooden_slab", new Block(0, 8, 16, 8, 53, 180, 47, true, false, true));
+        blocks.put("wooden_slab", new Block(0, 8, 16, 8, 53, 180, 47, true, false, true));
         //55
         //55
-        BLOCKS.put("cobblestone_slab", new Block(0, 8, 16, 8, 54, 600, 48, true, false, true));
+        blocks.put("cobblestone_slab", new Block(0, 8, 16, 8, 54, 600, 48, true, false, true));
         //56
         //56
-        BLOCKS.put("brick_slab", new Block(0, 8, 16, 8, 55, 600, 49, true, false, true));
+        blocks.put("brick_slab", new Block(0, 8, 16, 8, 55, 600, 49, true, false, true));
         //57
         //57
-        BLOCKS.put("stonebrick", new Block(64, 450, 50));
+        blocks.put("stonebrick", new Block(64, 450, 50));
         //58
         //58
-        BLOCKS.put("stone_brick_slab", new Block(0, 8, 16, 8, 56, 450, 51, true, false, true));
+        blocks.put("stone_brick_slab", new Block(0, 8, 16, 8, 56, 450, 51, true, false, true));
         //59
         //59
-        BLOCKS.put("cactus", new Block(1, 0, 14, 16, 57, 39, 52, true, false, true));
+        blocks.put("cactus", new Block(1, 0, 14, 16, 57, 39, 52, true, false, true));
         //60
         //60
-        BLOCKS.put("water_16", new Block(7, -1, 0, false, false, true));
+        blocks.put("water_16", new Block(7, -1, 0, false, false, true));
         //61
         //61
-        BLOCKS.put("water_12", new Block(58, -1, 0, false, false, true));
+        blocks.put("water_12", new Block(58, -1, 0, false, false, true));
         //62
         //62
-        BLOCKS.put("water_8", new Block(59, -1, 0, false, false, true));
+        blocks.put("water_8", new Block(59, -1, 0, false, false, true));
         //63
         //63
-        BLOCKS.put("water_4", new Block(60, -1, 0, false, false, true));
+        blocks.put("water_4", new Block(60, -1, 0, false, false, true));
         //64
         //64
-        BLOCKS.put("lava_16", new Block(8, -1, 0, false, false, true));
+        blocks.put("lava_16", new Block(8, -1, 0, false, false, true));
         //65
         //65
-        BLOCKS.put("lava_12", new Block(61, -1, 0, false, false, true));
+        blocks.put("lava_12", new Block(61, -1, 0, false, false, true));
         //66
         //66
-        BLOCKS.put("lava_8", new Block(62, -1, 0, false, false, true));
+        blocks.put("lava_8", new Block(62, -1, 0, false, false, true));
         //67
         //67
-        BLOCKS.put("lava_4", new Block(63, -1, 0, false, false, true));
+        blocks.put("lava_4", new Block(63, -1, 0, false, false, true));
         //68
         //68
-        BLOCKS.put("obsidian", new Block(65, 1500, 53));
+        blocks.put("obsidian", new Block(65, 1500, 53));
     }
 
     public static void load() {
     }
 
     public static void load() {
index 441d75f0f3940afb3b510b9d9acf1d29355c0128..de841190239a0d541bc3a84c59581017dd789ca5 100644 (file)
@@ -28,7 +28,7 @@ public class FallingGravel extends Mob {
 
     @Override
     public void draw(SpriteBatch spriteBatch, float x, float y) {
 
     @Override
     public void draw(SpriteBatch spriteBatch, float x, float y) {
-        spriteBatch.draw(Assets.blockTextures[Items.BLOCKS.get("gravel").getTexture()], x, y);
+        spriteBatch.draw(Assets.blockTex[Items.blocks.get("gravel").getTex()], x, y);
     }
 
     @Override
     }
 
     @Override
index a410eb3541a2cfc36d8108a3d6257d03865245c5..8c7661923ec57249a05ed11fa4b76175b0f0763c 100644 (file)
@@ -28,7 +28,7 @@ public class FallingSand extends Mob {
 
     @Override
     public void draw(SpriteBatch spriteBatch, float x, float y) {
 
     @Override
     public void draw(SpriteBatch spriteBatch, float x, float y) {
-        spriteBatch.draw(Assets.blockTextures[Items.BLOCKS.get("sand").getTexture()], x, y);
+        spriteBatch.draw(Assets.blockTex[Items.blocks.get("sand").getTex()], x, y);
     }
 
     @Override
     }
 
     @Override
index dfd8351dffbd6dc694ee9be42f8263e2c1311d64..839e383bfd48f63045ceaf21b29767eb65312aa1 100644 (file)
@@ -5,34 +5,34 @@ import com.badlogic.gdx.math.Rectangle;
 public class Block {
 
     private int x, y, w, h;
 public class Block {
 
     private int x, y, w, h;
-    private int texture;
+    private int tex;
     private int hp, drop;
 
     private int hp, drop;
 
-    public boolean collision, background, transparent;
+    public boolean coll, bg, tp;
 
 
-    public Block(int texture, int hp, int drop) {
-        this(0, 0, 16, 16, texture, hp, drop, true, false, false);
+    public Block(int tex, int hp, int drop) {
+        this(0, 0, 16, 16, tex, hp, drop, true, false, false);
     }
 
     }
 
-    public Block(int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
-        this(0, 0, 16, 16, texture, hp, drop, collision, background, transparent);
+    public Block(int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) {
+        this(0, 0, 16, 16, tex, hp, drop, coll, bg, tp);
     }
 
     }
 
-    public Block(int x, int y, int w, int h, int texture, int hp, int drop, boolean collision, boolean background, boolean transparent) {
+    public Block(int x, int y, int w, int h, int tex, int hp, int drop, boolean coll, boolean bg, boolean tp) {
         this.x = x;
         this.y = y;
         this.w = w;
         this.h = h;
         this.x = x;
         this.y = y;
         this.w = w;
         this.h = h;
-        this.texture = texture;
+        this.tex = tex;
         this.hp = hp;
         this.drop = drop;
         this.hp = hp;
         this.drop = drop;
-        this.collision = collision;
-        this.background = background;
-        this.transparent = transparent;
+        this.coll = coll;
+        this.bg = bg;
+        this.tp = tp;
     }
 
     }
 
-    public int getTexture() {
-        return texture;
+    public int getTex() {
+        return tex;
     }
 
     public int getHp() {
     }
 
     public int getHp() {
@@ -50,7 +50,7 @@ public class Block {
     }
 
     public boolean toJump() {
     }
 
     public boolean toJump() {
-        return (y < 8 && collision);
+        return (y < 8 && coll);
     }
 
 }
     }
 
 }
index 8c1388116b351913dd36323a9914d50e16f4b4ac..b34a91778ad9f61596afd9fe62a1d83e9fa0714b 100644 (file)
@@ -2,24 +2,24 @@ package ru.deadsoftware.cavecraft.game.objects;
 
 public class Item {
 
 
 public class Item {
 
-    private int texture;
+    private int tex;
     private int type; // 0 - block, 1 - tool, 2 - other
     private int block;
     private String name;
 
     private int type; // 0 - block, 1 - tool, 2 - other
     private int block;
     private String name;
 
-    public Item(String name, int texture, int type) {
-        this(name, texture, type, -1);
+    public Item(String name, int tex, int type) {
+        this(name, tex, type, -1);
     }
 
     }
 
-    public Item(String name, int texture, int type, int block) {
+    public Item(String name, int tex, int type, int block) {
         this.name = name;
         this.name = name;
-        this.texture = texture;
+        this.tex = tex;
         this.type = type;
         this.block = block;
     }
 
         this.type = type;
         this.block = block;
     }
 
-    public int getTexture() {
-        return texture;
+    public int getTex() {
+        return tex;
     }
 
     public int getType() {
     }
 
     public int getType() {
index d7da1c5bc0e1eadf7ea6b432465e56409c6f56e4..a1f50e665852aa9d6dd19681da5c423db21939c1 100644 (file)
@@ -13,14 +13,14 @@ import ru.deadsoftware.cavecraft.misc.Renderer;
 
 public class MenuRenderer extends Renderer {
 
 
 public class MenuRenderer extends Renderer {
 
-    public Array<Button> menuMainButtons;
+    public Array<Button> menuMainBtns;
 
     public MenuRenderer(int width) {
         super(width, width * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
 
     public MenuRenderer(int width) {
         super(width, width * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
-        menuMainButtons = new Array<Button>();
-        menuMainButtons.add(new Button("New game", getWidth() / 2 - 100, getHeight() / 4));
-        menuMainButtons.add(new Button("Load game", getWidth() / 2 - 100, getHeight() / 4 + 30, GameSaver.exists() ? 1 : 0));
-        menuMainButtons.add(new Button("Quit", getWidth() / 2 - 100, getHeight() / 4 + 60));
+        menuMainBtns = new Array<Button>();
+        menuMainBtns.add(new Button("New game", getWidth() / 2 - 100, getHeight() / 4));
+        menuMainBtns.add(new Button("Load game", getWidth() / 2 - 100, getHeight() / 4 + 30, GameSaver.exists() ? 1 : 0));
+        menuMainBtns.add(new Button("Quit", getWidth() / 2 - 100, getHeight() / 4 + 60));
     }
 
     public void buttonClicked(Button button) {
     }
 
     public void buttonClicked(Button button) {
@@ -34,7 +34,7 @@ public class MenuRenderer extends Renderer {
     }
 
     private void drawButton(Button button) {
     }
 
     private void drawButton(Button button) {
-        spriteBatch.draw(Assets.menuButton[button.getType()], button.getX(), button.getY());
+        spriter.draw(Assets.menuBtn[button.getType()], button.getX(), button.getY());
         setFontColor(255, 255, 255);
         drawString(button.getLabel(),
                 (button.getX() + button.getWidth() / 2) - Assets.getStringWidth(button.getLabel()) / 2,
         setFontColor(255, 255, 255);
         drawString(button.getLabel(),
                 (button.getX() + button.getWidth() / 2) - Assets.getStringWidth(button.getLabel()) / 2,
@@ -42,7 +42,7 @@ public class MenuRenderer extends Renderer {
     }
 
     private void drawMenuMain() {
     }
 
     private void drawMenuMain() {
-        for (Button button : menuMainButtons) {
+        for (Button button : menuMainBtns) {
             if (button.getType() > 0) {
                 if (button.getRect().contains(Gdx.input.getX() * getWidth() / GameScreen.getWidth(),
                         Gdx.input.getY() * getHeight() / GameScreen.getHeight()))
             if (button.getType() > 0) {
                 if (button.getRect().contains(Gdx.input.getX() * getWidth() / GameScreen.getWidth(),
                         Gdx.input.getY() * getHeight() / GameScreen.getHeight()))
@@ -59,13 +59,13 @@ public class MenuRenderer extends Renderer {
 
     @Override
     public void render() {
 
     @Override
     public void render() {
-        spriteBatch.begin();
+        spriter.begin();
         for (int x = 0; x <= getWidth() / 16; x++)
             for (int y = 0; y <= getHeight() / 16; y++) {
         for (int x = 0; x <= getWidth() / 16; x++)
             for (int y = 0; y <= getHeight() / 16; y++) {
-                spriteBatch.draw(Assets.blockTextures[Items.BLOCKS.get("dirt").getTexture()], x * 16, y * 16);
-                spriteBatch.draw(Assets.shade, x * 16, y * 16);
+                spriter.draw(Assets.blockTex[Items.blocks.get("dirt").getTex()], x * 16, y * 16);
+                spriter.draw(Assets.shade, x * 16, y * 16);
             }
             }
-        spriteBatch.draw(Assets.gameLogo, getWidth() / 2 - Assets.gameLogo.getWidth() / 2, 0);
+        spriter.draw(Assets.gameLogo, getWidth() / 2 - Assets.gameLogo.getWidth() / 2, 0);
 
         switch (CaveGame.STATE) {
             case MENU_MAIN:
 
         switch (CaveGame.STATE) {
             case MENU_MAIN:
@@ -82,7 +82,7 @@ public class MenuRenderer extends Renderer {
 
         drawString("CaveCraft " + CaveGame.VERSION, 0,
                 getHeight() - Assets.getStringHeight("CaveCraft " + CaveGame.VERSION) * 1.5f);
 
         drawString("CaveCraft " + CaveGame.VERSION, 0,
                 getHeight() - Assets.getStringHeight("CaveCraft " + CaveGame.VERSION) * 1.5f);
-        spriteBatch.end();
+        spriter.end();
 
         switch (CaveGame.STATE) {
             case GOTO_NEW_GAME:
 
         switch (CaveGame.STATE) {
             case GOTO_NEW_GAME:
index 9d74b0ead879b09390d9b1c134389a34ef21f4a3..676ed38f1a57c96b3c9d822b838d2a00bc239b79 100644 (file)
@@ -15,100 +15,100 @@ public class Assets {
 
     private static GlyphLayout layout;
 
 
     private static GlyphLayout layout;
 
-    public static BitmapFont minecraftFont;
+    public static BitmapFont mcFont;
 
     public static Sprite gameLogo;
 
 
     public static Sprite gameLogo;
 
-    public static Texture menuButtonTexture;
-    public static TextureRegion[] menuButton = new TextureRegion[3];
+    public static Texture menuBtnTex;
+    public static TextureRegion[] menuBtn = new TextureRegion[3];
 
 
-    public static Texture playerTexture;
-    public static Sprite[][] playerSprite = new Sprite[2][4];
+    public static Texture plTex;
+    public static Sprite[][] plSprite = new Sprite[2][4];
 
 
-    public static Texture pigTexture;
+    public static Texture pigTex;
     public static Sprite[][] pigSprite = new Sprite[2][2];
 
     public static Sprite shade;
 
     public static Texture terrain;
     public static Sprite[][] pigSprite = new Sprite[2][2];
 
     public static Sprite shade;
 
     public static Texture terrain;
-    public static Sprite[] blockTextures = new Sprite[BLOCK_TEXTURES];
+    public static Sprite[] blockTex = new Sprite[BLOCK_TEXTURES];
 
     public static Texture items;
 
     public static Texture items;
-    public static Sprite[] itemTextures = new Sprite[ITEM_TEXTURES];
+    public static Sprite[] itemTex = new Sprite[ITEM_TEXTURES];
 
     public static Texture gui;
     public static TextureRegion invBar;
     public static TextureRegion invBarCur;
     public static TextureRegion guiCur;
 
 
     public static Texture gui;
     public static TextureRegion invBar;
     public static TextureRegion invBarCur;
     public static TextureRegion guiCur;
 
-    public static Texture wreckTexture;
+    public static Texture wreckTex;
     public static TextureRegion[] wreck = new TextureRegion[10];
 
     public static TextureRegion[] wreck = new TextureRegion[10];
 
-    public static Texture creativeTexture;
+    public static Texture creativeTex;
     public static TextureRegion creativeInv;
     public static TextureRegion creativeInv;
-    public static TextureRegion creativeScroll;
+    public static TextureRegion creativeScr;
 
     public static Texture touchGui;
     public static TextureRegion[] touchArrows = new TextureRegion[4];
     public static TextureRegion touchLMB, touchRMB;
 
     public static Texture touchGui;
     public static TextureRegion[] touchArrows = new TextureRegion[4];
     public static TextureRegion touchLMB, touchRMB;
-    public static TextureRegion touchToggleMode;
+    public static TextureRegion touchMode;
     public static TextureRegion touchSpace;
 
     private static void loadPlayer() {
     public static TextureRegion touchSpace;
 
     private static void loadPlayer() {
-        playerTexture = new Texture(Gdx.files.internal("mobs/char.png"));
+        plTex = new Texture(Gdx.files.internal("mobs/char.png"));
         //LOOK TO LEFT
         //head
         //LOOK TO LEFT
         //head
-        playerSprite[0][0] = new Sprite(new TextureRegion(playerTexture, 0, 0, 12, 12));
-        playerSprite[0][0].flip(false, true);
+        plSprite[0][0] = new Sprite(new TextureRegion(plTex, 0, 0, 12, 12));
+        plSprite[0][0].flip(false, true);
         //body
         //body
-        playerSprite[0][1] = new Sprite(new TextureRegion(playerTexture, 0, 13, 12, 12));
-        playerSprite[0][1].flip(false, true);
+        plSprite[0][1] = new Sprite(new TextureRegion(plTex, 0, 13, 12, 12));
+        plSprite[0][1].flip(false, true);
         //hand
         //hand
-        playerSprite[0][2] = new Sprite(new TextureRegion(playerTexture, 25, 5, 20, 20));
-        playerSprite[0][2].flip(false, true);
+        plSprite[0][2] = new Sprite(new TextureRegion(plTex, 25, 5, 20, 20));
+        plSprite[0][2].flip(false, true);
         //leg
         //leg
-        playerSprite[0][3] = new Sprite(new TextureRegion(playerTexture, 25, 27, 20, 20));
-        playerSprite[0][3].flip(false, true);
+        plSprite[0][3] = new Sprite(new TextureRegion(plTex, 25, 27, 20, 20));
+        plSprite[0][3].flip(false, true);
         //LOOK TO RIGHT
         //head
         //LOOK TO RIGHT
         //head
-        playerSprite[1][0] = new Sprite(new TextureRegion(playerTexture, 13, 0, 12, 12));
-        playerSprite[1][0].flip(false, true);
+        plSprite[1][0] = new Sprite(new TextureRegion(plTex, 13, 0, 12, 12));
+        plSprite[1][0].flip(false, true);
         //body
         //body
-        playerSprite[1][1] = new Sprite(new TextureRegion(playerTexture, 13, 13, 12, 12));
-        playerSprite[1][1].flip(false, true);
+        plSprite[1][1] = new Sprite(new TextureRegion(plTex, 13, 13, 12, 12));
+        plSprite[1][1].flip(false, true);
         //hand
         //hand
-        playerSprite[1][2] = new Sprite(new TextureRegion(playerTexture, 37, 5, 20, 20));
-        playerSprite[1][2].flip(false, true);
+        plSprite[1][2] = new Sprite(new TextureRegion(plTex, 37, 5, 20, 20));
+        plSprite[1][2].flip(false, true);
         //leg
         //leg
-        playerSprite[1][3] = new Sprite(new TextureRegion(playerTexture, 37, 27, 20, 20));
-        playerSprite[1][3].flip(false, true);
+        plSprite[1][3] = new Sprite(new TextureRegion(plTex, 37, 27, 20, 20));
+        plSprite[1][3].flip(false, true);
     }
 
     private static void loadPig() {
     }
 
     private static void loadPig() {
-        pigTexture = new Texture(Gdx.files.internal("mobs/pig.png"));
-        pigSprite[0][0] = new Sprite(new TextureRegion(pigTexture, 0, 0, 25, 12));
+        pigTex = new Texture(Gdx.files.internal("mobs/pig.png"));
+        pigSprite[0][0] = new Sprite(new TextureRegion(pigTex, 0, 0, 25, 12));
         pigSprite[0][0].flip(false, true);
         pigSprite[0][0].flip(false, true);
-        pigSprite[1][0] = new Sprite(new TextureRegion(pigTexture, 0, 12, 25, 12));
+        pigSprite[1][0] = new Sprite(new TextureRegion(pigTex, 0, 12, 25, 12));
         pigSprite[1][0].flip(false, true);
         pigSprite[1][0].flip(false, true);
-        pigSprite[0][1] = new Sprite(new TextureRegion(pigTexture, 4, 26, 12, 12));
+        pigSprite[0][1] = new Sprite(new TextureRegion(pigTex, 4, 26, 12, 12));
         pigSprite[0][1].flip(false, true);
         pigSprite[0][1].flip(false, true);
-        pigSprite[1][1] = new Sprite(new TextureRegion(pigTexture, 16, 26, 12, 12));
+        pigSprite[1][1] = new Sprite(new TextureRegion(pigTex, 16, 26, 12, 12));
         pigSprite[1][1].flip(false, true);
     }
 
     public static void load() {
         pigSprite[1][1].flip(false, true);
     }
 
     public static void load() {
-        minecraftFont = new BitmapFont(Gdx.files.internal("font.fnt"), true);
-        minecraftFont.getData().setScale(.375f);
+        mcFont = new BitmapFont(Gdx.files.internal("font.fnt"), true);
+        mcFont.getData().setScale(.375f);
 
         layout = new GlyphLayout();
 
         gameLogo = new Sprite(new Texture(Gdx.files.internal("gamelogo.png")));
         gameLogo.flip(false, true);
 
 
         layout = new GlyphLayout();
 
         gameLogo = new Sprite(new Texture(Gdx.files.internal("gamelogo.png")));
         gameLogo.flip(false, true);
 
-        menuButtonTexture = new Texture(Gdx.files.internal("buttons.png"));
+        menuBtnTex = new Texture(Gdx.files.internal("buttons.png"));
         for (int i = 0; i < 3; i++) {
         for (int i = 0; i < 3; i++) {
-            menuButton[i] = new TextureRegion(menuButtonTexture, 0, 20 * i, 200, 20);
-            menuButton[i].flip(false, true);
+            menuBtn[i] = new TextureRegion(menuBtnTex, 0, 20 * i, 200, 20);
+            menuBtn[i].flip(false, true);
         }
 
         loadPlayer();
         }
 
         loadPlayer();
@@ -121,15 +121,15 @@ public class Assets {
         invBar = new TextureRegion(gui, 0, 16, 182, 22);
         invBarCur = new TextureRegion(gui, 0, 38, 24, 24);
 
         invBar = new TextureRegion(gui, 0, 16, 182, 22);
         invBarCur = new TextureRegion(gui, 0, 38, 24, 24);
 
-        creativeTexture = new Texture(Gdx.files.internal("allitems.png"));
-        creativeInv = new TextureRegion(creativeTexture, 0, 0, 176, 136);
+        creativeTex = new Texture(Gdx.files.internal("allitems.png"));
+        creativeInv = new TextureRegion(creativeTex, 0, 0, 176, 136);
         creativeInv.flip(false, true);
         creativeInv.flip(false, true);
-        creativeScroll = new TextureRegion(creativeTexture, 3, 137, 12, 15);
-        creativeScroll.flip(false, true);
+        creativeScr = new TextureRegion(creativeTex, 3, 137, 12, 15);
+        creativeScr.flip(false, true);
 
 
-        wreckTexture = new Texture(Gdx.files.internal("break.png"));
+        wreckTex = new Texture(Gdx.files.internal("break.png"));
         for (int i = 0; i < 10; i++) {
         for (int i = 0; i < 10; i++) {
-            wreck[i] = new TextureRegion(wreckTexture, 16 * i, 0, 16, 16);
+            wreck[i] = new TextureRegion(wreckTex, 16 * i, 0, 16, 16);
         }
 
         if (CaveGame.TOUCH) {
         }
 
         if (CaveGame.TOUCH) {
@@ -142,38 +142,37 @@ public class Assets {
             touchLMB.flip(false, true);
             touchRMB = new TextureRegion(touchGui, 52, 26, 26, 26);
             touchRMB.flip(false, true);
             touchLMB.flip(false, true);
             touchRMB = new TextureRegion(touchGui, 52, 26, 26, 26);
             touchRMB.flip(false, true);
-            touchToggleMode = new TextureRegion(touchGui, 26, 26, 26, 26);
-            touchToggleMode.flip(false, true);
+            touchMode = new TextureRegion(touchGui, 26, 26, 26, 26);
+            touchMode.flip(false, true);
             touchSpace = new TextureRegion(touchGui, 0, 52, 104, 26);
             touchSpace.flip(false, true);
         }
 
         terrain = new Texture(Gdx.files.internal("terrain.png"));
         for (int i = 0; i < BLOCK_TEXTURES; i++) {
             touchSpace = new TextureRegion(touchGui, 0, 52, 104, 26);
             touchSpace.flip(false, true);
         }
 
         terrain = new Texture(Gdx.files.internal("terrain.png"));
         for (int i = 0; i < BLOCK_TEXTURES; i++) {
-            blockTextures[i] = new Sprite(terrain,
+            blockTex[i] = new Sprite(terrain,
                     (i % 16) * 16, (i / 16) * 16, 16, 16);
                     (i % 16) * 16, (i / 16) * 16, 16, 16);
-            blockTextures[i].flip(false, true);
-            blockTextures[i].setSize(8, 8);
+            blockTex[i].flip(false, true);
+            blockTex[i].setSize(8, 8);
         }
         terrain = null;
 
         items = new Texture(Gdx.files.internal("items.png"));
         for (int i = 0; i < ITEM_TEXTURES; i++) {
         }
         terrain = null;
 
         items = new Texture(Gdx.files.internal("items.png"));
         for (int i = 0; i < ITEM_TEXTURES; i++) {
-            itemTextures[i] = new Sprite(items,
+            itemTex[i] = new Sprite(items,
                     (i % 16) * 16, (i / 16) * 16, 16, 16);
                     (i % 16) * 16, (i / 16) * 16, 16, 16);
-            itemTextures[i].flip(false, true);
-            //itemTextures[i].setSize(8,8);
+            itemTex[i].flip(false, true);
         }
         items = null;
     }
 
     public static int getStringWidth(String s) {
         }
         items = null;
     }
 
     public static int getStringWidth(String s) {
-        layout.setText(minecraftFont, s);
+        layout.setText(mcFont, s);
         return (int) layout.width;
     }
 
     public static int getStringHeight(String s) {
         return (int) layout.width;
     }
 
     public static int getStringHeight(String s) {
-        layout.setText(minecraftFont, s);
+        layout.setText(mcFont, s);
         return (int) layout.height;
     }
 
         return (int) layout.height;
     }
 
index 9978e0c99a9edebe2b7620bf07d6bf43c5210036..e3778de8fa8db68147698774ae176524c36f1a0d 100644 (file)
@@ -11,16 +11,16 @@ import static ru.deadsoftware.cavecraft.GameScreen.getWidth;
 
 public class InputHandlerGame implements InputProcessor {
 
 
 public class InputHandlerGame implements InputProcessor {
 
-    private GameProc gameProc;
+    private GameProc gp;
     private GameInput gameInput;
 
     private float tWidth, tHeight;
 
     private GameInput gameInput;
 
     private float tWidth, tHeight;
 
-    public InputHandlerGame(GameProc gameProc) {
-        this.gameProc = gameProc;
-        this.gameInput = new GameInput(gameProc);
-        tWidth = gameProc.renderer.camera.viewportWidth;
-        tHeight = gameProc.renderer.camera.viewportHeight;
+    public InputHandlerGame(GameProc gp) {
+        this.gp = gp;
+        this.gameInput = new GameInput(gp);
+        tWidth = gp.renderer.getWidth();
+        tHeight = gp.renderer.getHeight();
     }
 
     @Override
     }
 
     @Override
@@ -44,17 +44,17 @@ public class InputHandlerGame implements InputProcessor {
     public boolean touchDown(int screenX, int screenY, int pointer, int button) {
         int tx = (int) (screenX * tWidth / getWidth());
         int ty = (int) (screenY * tHeight / getHeight());
     public boolean touchDown(int screenX, int screenY, int pointer, int button) {
         int tx = (int) (screenX * tWidth / getWidth());
         int ty = (int) (screenY * tHeight / getHeight());
-        screenX *= gameProc.renderer.camera.viewportWidth / getWidth();
-        screenY *= gameProc.renderer.camera.viewportHeight / getHeight();
+        screenX *= gp.renderer.getWidth() / getWidth();
+        screenY *= gp.renderer.getHeight() / getHeight();
 
         if (CaveGame.TOUCH) {
             if (tx > 26 && tx < 52 && ty > tHeight - 52 && ty < tHeight - 26) {
 
         if (CaveGame.TOUCH) {
             if (tx > 26 && tx < 52 && ty > tHeight - 52 && ty < tHeight - 26) {
-                if (gameProc.ctrlMode == 1) gameInput.keyDown(Input.Keys.W);
+                if (gp.ctrlMode == 1) gameInput.keyDown(Input.Keys.W);
                 else gameInput.keyDown(Input.Keys.SPACE);
             } else if (tx > 0 && tx < 26 && ty > tHeight - 26) {
                 gameInput.keyDown(Input.Keys.A);
             } else if (tx > 26 && tx < 52 && ty > tHeight - 26) {
                 else gameInput.keyDown(Input.Keys.SPACE);
             } else if (tx > 0 && tx < 26 && ty > tHeight - 26) {
                 gameInput.keyDown(Input.Keys.A);
             } else if (tx > 26 && tx < 52 && ty > tHeight - 26) {
-                if (gameProc.ctrlMode == 1) gameInput.keyDown(Input.Keys.S);
+                if (gp.ctrlMode == 1) gameInput.keyDown(Input.Keys.S);
                 else gameInput.keyDown(Input.Keys.CONTROL_LEFT);
             } else if (tx > 52 && tx < 78 && ty > tHeight - 26) {
                 gameInput.keyDown(Input.Keys.D);
                 else gameInput.keyDown(Input.Keys.CONTROL_LEFT);
             } else if (tx > 52 && tx < 78 && ty > tHeight - 26) {
                 gameInput.keyDown(Input.Keys.D);
@@ -77,16 +77,16 @@ public class InputHandlerGame implements InputProcessor {
     public boolean touchUp(int screenX, int screenY, int pointer, int button) {
         int tx = (int) (screenX * tWidth / getWidth());
         int ty = (int) (screenY * tHeight / getHeight());
     public boolean touchUp(int screenX, int screenY, int pointer, int button) {
         int tx = (int) (screenX * tWidth / getWidth());
         int ty = (int) (screenY * tHeight / getHeight());
-        screenX *= gameProc.renderer.camera.viewportWidth / getWidth();
-        screenY *= gameProc.renderer.camera.viewportHeight / getHeight();
+        screenX *= gp.renderer.getWidth() / getWidth();
+        screenY *= gp.renderer.getHeight() / getHeight();
         if (CaveGame.TOUCH) {
             if (tx > 26 && tx < 52 && ty > tHeight - 52 && ty < tHeight - 26) {
         if (CaveGame.TOUCH) {
             if (tx > 26 && tx < 52 && ty > tHeight - 52 && ty < tHeight - 26) {
-                if (gameProc.ctrlMode == 1) gameInput.keyUp(Input.Keys.W);
+                if (gp.ctrlMode == 1) gameInput.keyUp(Input.Keys.W);
                 else gameInput.keyUp(Input.Keys.SPACE);
             } else if (tx > 0 && tx < 26 && ty > tHeight - 26) {
                 gameInput.keyUp(Input.Keys.A);
             } else if (tx > 26 && tx < 52 && ty > tHeight - 26) {
                 else gameInput.keyUp(Input.Keys.SPACE);
             } else if (tx > 0 && tx < 26 && ty > tHeight - 26) {
                 gameInput.keyUp(Input.Keys.A);
             } else if (tx > 26 && tx < 52 && ty > tHeight - 26) {
-                if (gameProc.ctrlMode == 1) gameInput.keyUp(Input.Keys.S);
+                if (gp.ctrlMode == 1) gameInput.keyUp(Input.Keys.S);
                 else gameInput.keyUp(Input.Keys.CONTROL_LEFT);
             } else if (tx > 52 && tx < 78 && ty > tHeight - 26) {
                 gameInput.keyUp(Input.Keys.D);
                 else gameInput.keyUp(Input.Keys.CONTROL_LEFT);
             } else if (tx > 52 && tx < 78 && ty > tHeight - 26) {
                 gameInput.keyUp(Input.Keys.D);
@@ -107,10 +107,10 @@ public class InputHandlerGame implements InputProcessor {
 
     @Override
     public boolean touchDragged(int screenX, int screenY, int pointer) {
 
     @Override
     public boolean touchDragged(int screenX, int screenY, int pointer) {
-        screenX *= gameProc.renderer.camera.viewportWidth / getWidth();
-        screenY *= gameProc.renderer.camera.viewportHeight / getHeight();
-        if (gameProc.isKeyDown && (screenX > 78 || screenY < gameProc.renderer.getHeight() - 52)) {
-            gameInput.keyUp(gameProc.keyDownCode);
+        screenX *= gp.renderer.getWidth() / getWidth();
+        screenY *= gp.renderer.getHeight() / getHeight();
+        if (gp.isKeyDown && (screenX > 78 || screenY < gp.renderer.getHeight() - 52)) {
+            gameInput.keyUp(gp.keyDownCode);
         } else {
             gameInput.touchDragged(screenX, screenY);
         }
         } else {
             gameInput.touchDragged(screenX, screenY);
         }
@@ -119,8 +119,8 @@ public class InputHandlerGame implements InputProcessor {
 
     @Override
     public boolean mouseMoved(int screenX, int screenY) {
 
     @Override
     public boolean mouseMoved(int screenX, int screenY) {
-        screenX *= gameProc.renderer.camera.viewportWidth / getWidth();
-        screenY *= gameProc.renderer.camera.viewportHeight / getHeight();
+        screenX *= gp.renderer.getWidth() / getWidth();
+        screenY *= gp.renderer.getHeight() / getHeight();
         gameInput.mouseMoved(screenX, screenY);
         return false;
     }
         gameInput.mouseMoved(screenX, screenY);
         return false;
     }
index d551b58c29145dd062023fd929d75d9c0d6e3878..bb6044412570fc3d7b86eb3ce0d769b271df30ef 100644 (file)
@@ -7,10 +7,10 @@ import ru.deadsoftware.cavecraft.menu.objects.Button;
 
 public class InputHandlerMenu implements InputProcessor {
 
 
 public class InputHandlerMenu implements InputProcessor {
 
-    private MenuRenderer renderer;
+    private MenuRenderer menuRenderer;
 
 
-    public InputHandlerMenu(MenuRenderer renderer) {
-        this.renderer = renderer;
+    public InputHandlerMenu(MenuRenderer menuRenderer) {
+        this.menuRenderer = menuRenderer;
     }
 
     @Override
     }
 
     @Override
@@ -35,10 +35,10 @@ public class InputHandlerMenu implements InputProcessor {
 
     @Override
     public boolean touchUp(int screenX, int screenY, int pointer, int mb) {
 
     @Override
     public boolean touchUp(int screenX, int screenY, int pointer, int mb) {
-        screenX *= renderer.getWidth() / GameScreen.getWidth();
-        screenY *= renderer.getHeight() / GameScreen.getHeight();
-        for (Button button : renderer.menuMainButtons) {
-            if (button.getRect().contains(screenX, screenY) && button.getType() > 0) renderer.buttonClicked(button);
+        screenX *= menuRenderer.getWidth() / GameScreen.getWidth();
+        screenY *= menuRenderer.getHeight() / GameScreen.getHeight();
+        for (Button button : menuRenderer.menuMainBtns) {
+            if (button.getRect().contains(screenX, screenY) && button.getType() > 0) menuRenderer.buttonClicked(button);
         }
         return false;
     }
         }
         return false;
     }
index 72f8a59929b8935f849dccca515f94fc37e23bfc..c22ec4901f3c37328d70bf84fc594e2f164503cd 100644 (file)
@@ -7,9 +7,10 @@ import ru.deadsoftware.cavecraft.GameScreen;
 
 public abstract class Renderer {
 
 
 public abstract class Renderer {
 
-    public OrthographicCamera camera;
-    public ShapeRenderer shapeRenderer;
-    public SpriteBatch spriteBatch;
+    private OrthographicCamera camera;
+
+    public ShapeRenderer shaper;
+    public SpriteBatch spriter;
 
     public Renderer() {
         this(GameScreen.getWidth(), GameScreen.getHeight());
 
     public Renderer() {
         this(GameScreen.getWidth(), GameScreen.getHeight());
@@ -18,10 +19,10 @@ public abstract class Renderer {
     public Renderer(float width, float height) {
         camera = new OrthographicCamera();
         camera.setToOrtho(true, width, height);
     public Renderer(float width, float height) {
         camera = new OrthographicCamera();
         camera.setToOrtho(true, width, height);
-        shapeRenderer = new ShapeRenderer();
-        shapeRenderer.setProjectionMatrix(camera.combined);
-        spriteBatch = new SpriteBatch();
-        spriteBatch.setProjectionMatrix(camera.combined);
+        shaper = new ShapeRenderer();
+        shaper.setProjectionMatrix(camera.combined);
+        spriter = new SpriteBatch();
+        spriter.setProjectionMatrix(camera.combined);
     }
 
     public float getWidth() {
     }
 
     public float getWidth() {
@@ -32,20 +33,32 @@ public abstract class Renderer {
         return camera.viewportHeight;
     }
 
         return camera.viewportHeight;
     }
 
+    public float getCamX() {
+        return camera.position.x;
+    }
+
+    public float getCamY() {
+        return camera.position.y;
+    }
+
+    public void setCamPos(float x, float y) {
+        camera.position.set(x, y, 0);
+    }
+
     public void setFontScale(float scale) {
     public void setFontScale(float scale) {
-        Assets.minecraftFont.getData().setScale(scale);
+        Assets.mcFont.getData().setScale(scale);
     }
 
     public void setFontColor(int r, int g, int b) {
     }
 
     public void setFontColor(int r, int g, int b) {
-        Assets.minecraftFont.setColor(r / 255f, g / 255f, b / 255f, 1f);
+        Assets.mcFont.setColor(r / 255f, g / 255f, b / 255f, 1f);
     }
 
     public void drawString(String str, float x, float y) {
     }
 
     public void drawString(String str, float x, float y) {
-        Assets.minecraftFont.draw(spriteBatch, str, x, y);
+        Assets.mcFont.draw(spriter, str, x, y);
     }
 
     public void drawString(String str) {
     }
 
     public void drawString(String str) {
-        Assets.minecraftFont.draw(spriteBatch, str,
+        Assets.mcFont.draw(spriter, str,
                 getWidth() / 2 - Assets.getStringWidth(str) / 2,
                 getHeight() / 2 - Assets.getStringHeight(str) / 2);
     }
                 getWidth() / 2 - Assets.getStringWidth(str) / 2,
                 getHeight() / 2 - Assets.getStringHeight(str) / 2);
     }