From: fred-boy Date: Wed, 25 Apr 2018 16:04:18 +0000 (+0700) Subject: Remove meta map X-Git-Tag: alpha0.4~98 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=597ab66d10b43233da31893d0d074485d5aa0bd2;p=cavedroid.git Remove meta map Clean up --- diff --git a/android/assets/gamelogo_s.png b/android/assets/gamelogo_s.png deleted file mode 100644 index e91b200..0000000 Binary files a/android/assets/gamelogo_s.png and /dev/null differ diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java index e177f40..2e54ad3 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java @@ -121,12 +121,13 @@ public class GameInput { } } else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) { CaveGame.STATE = AppState.GAME_PLAY; + } else { + gameProc.touchDownTime = TimeUtils.millis(); + gameProc.isTouchDown = true; + gameProc.touchDownButton = button; } gameProc.touchDownX = screenX; gameProc.touchDownY = screenY; - gameProc.touchDownTime = TimeUtils.millis(); - gameProc.isTouchDown = true; - gameProc.touchDownButton = button; } public void touchUp(int screenX, int screenY, int button) { diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java index 38c79f1..7ab146b 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java @@ -121,7 +121,7 @@ public class GameRenderer extends Renderer { 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+1)))); + y+18+(gameProc.creativeScroll*(72/gameProc.maxCreativeScroll))); for (int i=gameProc.creativeScroll*40; i<(gameProc.creativeScroll+1)*40; i++) { if (i>0 && i(); gameProc.physics = new GamePhysics(gameProc); gameProc.resetRenderer(); } catch (Exception e) { diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java index 5f5a407..4a14c71 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java @@ -2,13 +2,10 @@ package ru.deadsoftware.cavecraft.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.utils.ArrayMap; public class GameWorld { private int WIDTH, HEIGHT; - - public ArrayMap metaMap; private int[][] foreMap; private int[][] backMap; @@ -28,11 +25,16 @@ public class GameWorld { return backMap; } + private int transformX(int x) { + x = x%getWidth(); + if (x<0) x=getWidth()-Math.abs(x); + return x; + } + public int getForeMap(int x, int y) { int map = 0; try { - x = x%getWidth(); - if (x<0) x=getWidth()-Math.abs(x); + x = transformX(x); map = foreMap[x][y]; } catch (ArrayIndexOutOfBoundsException e) { Gdx.app.error("GameWorld",e.toString()); @@ -42,8 +44,7 @@ public class GameWorld { public void setForeMap(int x, int y, int value) { try { - x = x%getWidth(); - if (x<0) x=getWidth()-Math.abs(x); + x = transformX(x); foreMap[x][y] = value; } catch (ArrayIndexOutOfBoundsException e) { Gdx.app.error("GameWorld", e.toString()); @@ -53,8 +54,7 @@ public class GameWorld { public int getBackMap(int x, int y) { int map = 0; try { - x = x%getWidth(); - if (x<0) x=getWidth()-Math.abs(x); + x = transformX(x); map = backMap[x][y]; } catch (ArrayIndexOutOfBoundsException e) { Gdx.app.error("GameWorld",e.toString()); @@ -64,32 +64,21 @@ public class GameWorld { public void setBackMap(int x, int y, int value) { try { - x = x%getWidth(); - if (x<0) x=getWidth()-Math.abs(x); + x = transformX(x); backMap[x][y] = value; } catch (ArrayIndexOutOfBoundsException e) { Gdx.app.error("GameWorld", e.toString()); } } - public int getMeta(int x, int y) { - if (metaMap.containsKey(x+"_"+y)) return metaMap.get(x+"_"+y); - else return 0; - } - - public void setMeta(int x, int y, int value) { - if (metaMap.containsKey(x+"_"+y)) metaMap.removeKey(x+"_"+y); - metaMap.put(x+"_"+y, value); - } - public void placeToForeground(int x, int y, int value) { if (getForeMap(x,y) == 0 || value == 0) { - setForeMap(x,y,value); + setForeMap(x, y, value); } } public void placeToBackground(int x, int y, int value) { - if (value==0 || (getBackMap(x,y) == 0 && !Items.BLOCKS.getValueAt(value).background)) { + if (value==0 || (getBackMap(x,y) == 0 && Items.BLOCKS.getValueAt(value).collision)) { setBackMap(x,y,value); } } @@ -111,7 +100,6 @@ public class GameWorld { WorldGen.genWorld(WIDTH,HEIGHT); foreMap = WorldGen.getForeMap(); backMap = WorldGen.getBackMap(); - metaMap = new ArrayMap(); WorldGen.clear(); } diff --git a/core/src/ru/deadsoftware/cavecraft/game/Items.java b/core/src/ru/deadsoftware/cavecraft/game/Items.java index 93b9a1f..6d49b5d 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/Items.java +++ b/core/src/ru/deadsoftware/cavecraft/game/Items.java @@ -2,7 +2,6 @@ package ru.deadsoftware.cavecraft.game; import com.badlogic.gdx.utils.ArrayMap; import ru.deadsoftware.cavecraft.game.objects.Block; -import ru.deadsoftware.cavecraft.misc.Assets; public class Items { @@ -32,7 +31,8 @@ public class Items { BLOCKS.put("lapis_block", new Block(19)); BLOCKS.put("sandstone", new Block(20)); BLOCKS.put("noteblock", new Block(21)); - BLOCKS.put("bed", new Block(0,8,16,8,22,false,true,true)); + BLOCKS.put("bed_l", new Block(22,false,true,true)); + BLOCKS.put("bed_r", new Block(23, false,true, true)); BLOCKS.put("cobweb", new Block(24,false,false,true)); BLOCKS.put("tallgrass", new Block(25,false,false,true)); BLOCKS.put("deadbush", new Block(26,false,false,true)); @@ -41,7 +41,22 @@ public class Items { BLOCKS.put("rose", new Block(29,false,false,true)); BLOCKS.put("brown_mushroom", new Block(30,false,false,true)); BLOCKS.put("red_mushroom", new Block(31,false,false,true)); - BLOCKS.put("wool", new Block(32,false,true,false)); + BLOCKS.put("wool_while", new Block(32,true,false,false)); + BLOCKS.put("wool_orange", new Block(33,true,false,false)); + BLOCKS.put("wool_magenta", new Block(34,true,false,false)); + BLOCKS.put("wool_lightblue", new Block(35,true,false,false)); + BLOCKS.put("wool_yellow", new Block(36,true,false,false)); + BLOCKS.put("wool_lime", new Block(37,true,false,false)); + BLOCKS.put("wool_pink", new Block(38,true,false,false)); + BLOCKS.put("wool_gray", new Block(39,true,false,false)); + BLOCKS.put("wool_lightgray", new Block(40,true,false,false)); + BLOCKS.put("wool_cyan", new Block(41,true,false,false)); + BLOCKS.put("wool_purple", new Block(42,true,false,false)); + BLOCKS.put("wool_blue", new Block(43,true,false,false)); + BLOCKS.put("wool_brown", new Block(44,true,false,false)); + BLOCKS.put("wool_green", new Block(45,true,false,false)); + BLOCKS.put("wool_red", new Block(46,true,false,false)); + BLOCKS.put("wool_black", new Block(47,true,false,false)); } public static void load() { diff --git a/core/src/ru/deadsoftware/cavecraft/misc/Assets.java b/core/src/ru/deadsoftware/cavecraft/misc/Assets.java index 28f3508..87e04af 100644 --- a/core/src/ru/deadsoftware/cavecraft/misc/Assets.java +++ b/core/src/ru/deadsoftware/cavecraft/misc/Assets.java @@ -10,7 +10,7 @@ import ru.deadsoftware.cavecraft.CaveGame; public class Assets { - public static final int BLOCK_TEXTURES = 47; + public static final int BLOCK_TEXTURES = 48; private static GlyphLayout layout;