From f060e7a42055032c9271d0032ced49ef65c6032c Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Thu, 27 Jul 2023 20:40:51 +0200 Subject: [PATCH] Merge VEHICLES, SHADOWS and OBSTACLES ZLevel into ON_GROUND --- core/src/com/agateau/pixelwheels/ZLevel.java | 10 ++++------ core/src/com/agateau/pixelwheels/bonus/BonusSpot.java | 2 +- core/src/com/agateau/pixelwheels/bonus/Mine.java | 2 +- .../pixelwheels/gameobject/AnimationObject.java | 2 +- .../com/agateau/pixelwheels/obstacles/Obstacle.java | 4 ++-- .../com/agateau/pixelwheels/racer/VehicleRenderer.java | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/core/src/com/agateau/pixelwheels/ZLevel.java b/core/src/com/agateau/pixelwheels/ZLevel.java index ff499202..85001483 100644 --- a/core/src/com/agateau/pixelwheels/ZLevel.java +++ b/core/src/com/agateau/pixelwheels/ZLevel.java @@ -20,11 +20,9 @@ /** The drawing layers, ordered from bottom to top */ public enum ZLevel { - GROUND, // bgX layers, skidmarks, vehicle shadows, mines, bullets... - VEHICLES, - SHADOWS, // obstacle and helicopter shadows - OBSTACLES, // obstacles - FLYING_LOW, // missiles - FG_LAYERS, // fgX layers + GROUND, // bgX layers, skidmarks, vehicle and obstacle shadows, mines, bullets... + ON_GROUND, // vehicles, obstacles, bonus, mine + FLYING_LOW, // missiles, explosions, impacts + FG_LAYERS, // fgX layers, helicopter shadow FLYING_HIGH, // helicopter, vehicles being carried by helicopter } diff --git a/core/src/com/agateau/pixelwheels/bonus/BonusSpot.java b/core/src/com/agateau/pixelwheels/bonus/BonusSpot.java index a587d479..d353f66f 100644 --- a/core/src/com/agateau/pixelwheels/bonus/BonusSpot.java +++ b/core/src/com/agateau/pixelwheels/bonus/BonusSpot.java @@ -106,7 +106,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) { if (zLevel == ZLevel.GROUND) { mDrawer.setBatch(batch); mDrawer.drawShadow(mBody, mRegion); - } else if (zLevel == ZLevel.OBSTACLES) { + } else if (zLevel == ZLevel.ON_GROUND) { mDrawer.setBatch(batch); mDrawer.draw(mBody, mRegion); } diff --git a/core/src/com/agateau/pixelwheels/bonus/Mine.java b/core/src/com/agateau/pixelwheels/bonus/Mine.java index 913f76d1..5ab3d72d 100644 --- a/core/src/com/agateau/pixelwheels/bonus/Mine.java +++ b/core/src/com/agateau/pixelwheels/bonus/Mine.java @@ -188,7 +188,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) { TextureRegion region = mAssets.mine.getKeyFrame(mTime); mBodyRegionDrawer.drawShadow(mBody, region); } - if (zLevel == ZLevel.VEHICLES) { + if (zLevel == ZLevel.ON_GROUND) { TextureRegion region = mAssets.mine.getKeyFrame(mTime); mBodyRegionDrawer.draw(mBody, region); } diff --git a/core/src/com/agateau/pixelwheels/gameobject/AnimationObject.java b/core/src/com/agateau/pixelwheels/gameobject/AnimationObject.java index 1617f2bd..09b80ad5 100644 --- a/core/src/com/agateau/pixelwheels/gameobject/AnimationObject.java +++ b/core/src/com/agateau/pixelwheels/gameobject/AnimationObject.java @@ -69,7 +69,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) { if (mTime < 0) { return; } - if (zLevel != ZLevel.OBSTACLES) { + if (zLevel != ZLevel.FLYING_LOW) { return; } TextureRegion region = mAnimation.getKeyFrame(mTime); diff --git a/core/src/com/agateau/pixelwheels/obstacles/Obstacle.java b/core/src/com/agateau/pixelwheels/obstacles/Obstacle.java index 97a2f96d..06cc7ded 100644 --- a/core/src/com/agateau/pixelwheels/obstacles/Obstacle.java +++ b/core/src/com/agateau/pixelwheels/obstacles/Obstacle.java @@ -75,13 +75,13 @@ public void act(float delta) { @Override public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) { - if (zLevel != ZLevel.OBSTACLES && zLevel != ZLevel.SHADOWS) { + if (zLevel != ZLevel.ON_GROUND && zLevel != ZLevel.GROUND) { return; } if (!AgcMathUtils.rectangleContains(viewBounds, getPosition(), mRegionRadius)) { return; } - if (zLevel == ZLevel.OBSTACLES) { + if (zLevel == ZLevel.ON_GROUND) { mBodyRegionDrawer.setBatch(batch); mBodyRegionDrawer.draw(mBody, mRegion); } else { diff --git a/core/src/com/agateau/pixelwheels/racer/VehicleRenderer.java b/core/src/com/agateau/pixelwheels/racer/VehicleRenderer.java index 060b9b8c..9668919b 100644 --- a/core/src/com/agateau/pixelwheels/racer/VehicleRenderer.java +++ b/core/src/com/agateau/pixelwheels/racer/VehicleRenderer.java @@ -162,7 +162,7 @@ public void draw(Batch batch, ZLevel zLevel, Rectangle viewBounds) { } // Vehicle level: wheels and body - ZLevel wantedZIndex = mVehicle.isFlying() ? ZLevel.FLYING_HIGH : ZLevel.VEHICLES; + ZLevel wantedZIndex = mVehicle.isFlying() ? ZLevel.FLYING_HIGH : ZLevel.ON_GROUND; if (zLevel != wantedZIndex) { return; }