diff --git a/out/production/Terrarum_renewed/com/Torvald/Rand/FudgeDice.class b/out/production/Terrarum_renewed/com/Torvald/Rand/FudgeDice.class index efe4d380a..01fa627d1 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Rand/FudgeDice.class and b/out/production/Terrarum_renewed/com/Torvald/Rand/FudgeDice.class differ 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 c930a4e61..5f0b0832b 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/MapDrawer/LightmapLantern.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class index 333194740..ca2dec3d0 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.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 2006e886b..8e8ee5530 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/res/graphics/sprites/test_player.png b/res/graphics/sprites/test_player.png index ab0901806..139518041 100644 Binary files a/res/graphics/sprites/test_player.png and b/res/graphics/sprites/test_player.png differ diff --git a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java index cc6e7fc0f..29f74d170 100644 --- a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java +++ b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java @@ -57,6 +57,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 static final int TSIZE = MapDrawer.TILE_SIZE; private static int AUTO_CLIMB_RATE = TSIZE / 8; @@ -163,6 +164,7 @@ public class ActorWithBody implements Actor, Visible, Glowing { /** * Update variables */ + if (mass < MASS_LOWEST) mass = MASS_LOWEST; // clamp to minimum possible mass baseSpriteHeight = sprite.getHeight(); baseSpriteWidth = sprite.getWidth(); gravitation = Terrarum.game.map.getGravitation(); @@ -259,7 +261,7 @@ public class ActorWithBody implements Actor, Visible, Glowing { } private void adjustHitBottom() { - float newX = nextHitbox.getPointedX(); + float newX = nextHitbox.getPointedX(); // look carefully, getPos or getPointed // int-ify posY of nextHitbox nextHitbox.setPositionYFromPoint( FastMath.floor(nextHitbox.getPointedY()) ); @@ -275,10 +277,10 @@ public class ActorWithBody implements Actor, Visible, Glowing { nextHitbox.setPositionFromPoint(newX, newY + 1); } - private void adjustHitTop() { // FIXME jump to teleport to ceiling - float newX = nextHitbox.getPointedX(); + private void adjustHitTop() { + float newX = nextHitbox.getPosX(); // int-ify posY of nextHitbox - nextHitbox.setPositionY( FastMath.floor(nextHitbox.getPosY()) ); + nextHitbox.setPositionY( FastMath.ceil(nextHitbox.getPosY()) ); int newYOff = 0; // always positive @@ -289,7 +291,7 @@ public class ActorWithBody implements Actor, Visible, Glowing { } while (colliding); float newY = nextHitbox.getPosY() + newYOff; - nextHitbox.setPositionFromPoint(newX, newY - 1); + nextHitbox.setPosition(newX, newY - 1); } private void updateHorizontalPos() { diff --git a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java index 656e220e9..465b65132 100644 --- a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java +++ b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java @@ -150,24 +150,30 @@ public class LightmapRenderer { if (Terrarum.game.screenZoom >= 1 && ((boolean) Terrarum.game.gameConfig.get("smoothlighting"))) { char thisLightLevel = staticLightMap[y][x]; if (y > 0 && x < for_x_end && thisLightLevel == 0 && staticLightMap[y - 1][x] == 0) { - // coalesce zero intensity blocks to one - int zeroLevelCounter = 1; - while (staticLightMap[y][x + zeroLevelCounter] == 0 - && staticLightMap[y - 1][x + zeroLevelCounter] == 0) { - zeroLevelCounter += 1; + try { + // coalesce zero intensity blocks to one + int zeroLevelCounter = 1; + while (staticLightMap[y][x + zeroLevelCounter] == 0 + && staticLightMap[y - 1][x + zeroLevelCounter] == 0) { + zeroLevelCounter += 1; - if (x + zeroLevelCounter >= for_x_end) break; + if (x + zeroLevelCounter >= for_x_end) break; + } + + g.setColor(new Color(0)); + g.fillRect( + Math.round(x * TSIZE * Terrarum.game.screenZoom) + , Math.round(y * TSIZE * Terrarum.game.screenZoom) + , FastMath.ceil( + TSIZE * Terrarum.game.screenZoom) * zeroLevelCounter + , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) + ); + + x += (zeroLevelCounter - 1); + } + catch (ArrayIndexOutOfBoundsException e) { + // do nothing } - - g.setColor(new Color(0)); - g.fillRect( - Math.round(x * TSIZE * Terrarum.game.screenZoom) - , Math.round(y * TSIZE * Terrarum.game.screenZoom) - , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) * zeroLevelCounter - , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) - ); - - x += (zeroLevelCounter - 1); } else { /** a @@ -216,25 +222,30 @@ public class LightmapRenderer { } // Retro else { - int thisLightLevel = staticLightMap[y][x]; + try { + int thisLightLevel = staticLightMap[y][x]; - // coalesce identical intensity blocks to one - int sameLevelCounter = 1; - while (staticLightMap[y][x + sameLevelCounter] == thisLightLevel) { - sameLevelCounter += 1; + // coalesce identical intensity blocks to one + int sameLevelCounter = 1; + while (staticLightMap[y][x + sameLevelCounter] == thisLightLevel) { + sameLevelCounter += 1; - if (x + sameLevelCounter >= for_x_end) break; + if (x + sameLevelCounter >= for_x_end) break; + } + + g.setColor(toTargetColour(staticLightMap[y][x])); + g.fillRect( + Math.round(x * TSIZE * Terrarum.game.screenZoom) + , Math.round(y * TSIZE * Terrarum.game.screenZoom) + , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) * sameLevelCounter + , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) + ); + + x += (sameLevelCounter - 1); + } + catch (ArrayIndexOutOfBoundsException e) { + // do nothing } - - g.setColor(toTargetColour(staticLightMap[y][x])); - g.fillRect( - Math.round(x * TSIZE * Terrarum.game.screenZoom) - , Math.round(y * TSIZE * Terrarum.game.screenZoom) - , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) * sameLevelCounter - , FastMath.ceil(TSIZE * Terrarum.game.screenZoom) - ); - - x += (sameLevelCounter - 1); } } }