diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class index 638ee9445..e7f10bba6 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class index 264b51c2f..aaf52e7a3 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class index 8e8ee5530..cdf37ae70 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/MapCamera.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/MapCamera.class index 0d352be17..62846ee1a 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/MapCamera.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/MapCamera.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileStat/TileStat.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileStat/TileStat.class index 481876d1c..af025a93b 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileStat/TileStat.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileStat/TileStat.class differ diff --git a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java index 50ad53bfd..c65a8dee8 100644 --- a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java +++ b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java @@ -37,8 +37,6 @@ public class ActorWithBody implements Actor, Visible, Glowing { private final float VELO_HARD_LIMIT = 10000; boolean grounded = false; - boolean walledLeft = false; - boolean walledRight = false; SpriteAnimation sprite; @Nullable SpriteAnimation spriteGlow; @@ -57,7 +55,7 @@ public class ActorWithBody implements Actor, Visible, Glowing { */ private volatile float scale = 1; private volatile float mass = 1f; - private final float MASS_LOWEST = Float.MIN_NORMAL; + private final float MASS_LOWEST = 2f; private static final int TSIZE = MapDrawer.TILE_SIZE; private static int AUTO_CLIMB_RATE = TSIZE / 8; @@ -687,14 +685,6 @@ public class ActorWithBody implements Actor, Visible, Glowing { return grounded; } - public boolean isWalledLeft() { - return walledLeft; - } - - public boolean isWalledRight() { - return walledRight; - } - public int getBaseHitboxW() { return baseHitboxW; } diff --git a/src/com/Torvald/Terrarum/Game.java b/src/com/Torvald/Terrarum/Game.java index 0a1ca08c2..55a02232d 100644 --- a/src/com/Torvald/Terrarum/Game.java +++ b/src/com/Torvald/Terrarum/Game.java @@ -145,8 +145,6 @@ public class Game extends BasicGameState { TileStat.update(); - - actorContainer.forEach(actor -> actor.update(gc, delta_t)); actorContainer.forEach( actor -> { @@ -158,10 +156,7 @@ public class Game extends BasicGameState { } } ); - - /** Placed before actor update to give some dynamic view of player on screen, - * or else player will always stay same spot, which is somewhat dull. - */ + MapDrawer.update(gc, delta_t); MapCamera.update(gc, delta_t); diff --git a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java index 465b65132..958d8b68f 100644 --- a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java +++ b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java @@ -85,11 +85,11 @@ public class LightmapRenderer { } - int for_y_start = div16(MapCamera.getCameraY()); - int for_x_start = div16(MapCamera.getCameraX()); + int for_y_start = div16(MapCamera.getCameraY()) - MUL; + int for_x_start = div16(MapCamera.getCameraX()) - MUL; - int for_y_end = clampHTile(for_y_start + div16(MapCamera.getRenderHeight()) + 2); - int for_x_end = clampWTile(for_x_start + div16(MapCamera.getRenderWidth()) + 2); + int for_y_end = clampHTile(for_y_start + div16(MapCamera.getRenderHeight()) + 2) + MUL; + int for_x_end = clampWTile(for_x_start + div16(MapCamera.getRenderWidth()) + 2) + MUL; /** * Updating order: diff --git a/src/com/Torvald/Terrarum/MapDrawer/MapCamera.java b/src/com/Torvald/Terrarum/MapDrawer/MapCamera.java index fda1a0d41..638ebab33 100644 --- a/src/com/Torvald/Terrarum/MapDrawer/MapCamera.java +++ b/src/com/Torvald/Terrarum/MapDrawer/MapCamera.java @@ -137,14 +137,14 @@ public class MapCamera { renderHeight = FastMath.ceil(Terrarum.HEIGHT / Terrarum.game.screenZoom); // position - (WH / 2) - cameraX = clamp( - Math.round(player.getHitbox().getCenteredX() - (renderWidth / 2)) - , map.width * TSIZE - renderWidth - ); - cameraY = clamp( - Math.round(player.getHitbox().getCenteredY() - (renderHeight / 2)) - , map.height * TSIZE - renderHeight - ); + cameraX = Math.round(FastMath.clamp( + player.getHitbox().getCenteredX() - (renderWidth / 2) + , TSIZE, map.width * TSIZE - renderWidth - TSIZE + )); + cameraY = Math.round(FastMath.clamp( + player.getHitbox().getCenteredY() - (renderHeight / 2) + , TSIZE, map.height * TSIZE - renderHeight - TSIZE + )); } public static void renderBehind(GameContainer gc, Graphics g) { @@ -371,18 +371,6 @@ public class MapCamera { } } - public static int clamp(int x, int lim) { - if (x < 0) { - return 0; - } - else if (x > lim) { - return lim; - } - else { - return x; - } - } - private static Image getTileByIndex(SpriteSheet s, int i) { return s.getSprite(i % 16, i / 16); } diff --git a/src/com/Torvald/Terrarum/TileStat/TileStat.java b/src/com/Torvald/Terrarum/TileStat/TileStat.java index a33904126..3d2721556 100644 --- a/src/com/Torvald/Terrarum/TileStat/TileStat.java +++ b/src/com/Torvald/Terrarum/TileStat/TileStat.java @@ -35,14 +35,14 @@ public class TileStat { int renderWidth = FastMath.ceil(Terrarum.WIDTH); int renderHeight = FastMath.ceil(Terrarum.HEIGHT); - int noZoomCameraX = MapCamera.clamp( - Math.round(player.getHitbox().getPointedX() - (renderWidth / 2)) - , map.width * TSIZE - renderWidth - ); - int noZoomCameraY = MapCamera.clamp( - Math.round(player.getHitbox().getPointedY() - (renderHeight / 2)) - , map.height * TSIZE - renderHeight - ); + int noZoomCameraX = Math.round(FastMath.clamp( + player.getHitbox().getCenteredX() - (renderWidth / 2) + , TSIZE, map.width * TSIZE - renderWidth - TSIZE + )); + int noZoomCameraY = Math.round(FastMath.clamp( + player.getHitbox().getCenteredY() - (renderHeight / 2) + , TSIZE, map.height * TSIZE - renderHeight - TSIZE + )); int for_x_start = MapCamera.div16(noZoomCameraX); int for_y_start = MapCamera.div16(noZoomCameraY);