From 3759d32c8948194259d0a9b10d7b0606f47113a3 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 7 Nov 2018 16:56:47 -0500 Subject: [PATCH] Improved map previews --- core/src/io/anuke/mindustry/entities/Player.java | 4 ++-- core/src/io/anuke/mindustry/io/MapIO.java | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index cf98629d50..a454e2078c 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -512,14 +512,14 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra achievedFlight = true; } - if(boostHeat <= liftoffBoost + 0.05f && achievedFlight){ + if(boostHeat <= liftoffBoost + 0.05f && achievedFlight && !mech.flying){ if(tile != null){ if(mech.shake > 1f){ Effects.shake(mech.shake, mech.shake, this); } Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f); } - if(!mech.flying) mech.onLand(this); + mech.onLand(this); achievedFlight = false; } diff --git a/core/src/io/anuke/mindustry/io/MapIO.java b/core/src/io/anuke/mindustry/io/MapIO.java index 4e07de02e3..c46e9bf6d3 100644 --- a/core/src/io/anuke/mindustry/io/MapIO.java +++ b/core/src/io/anuke/mindustry/io/MapIO.java @@ -47,23 +47,15 @@ public class MapIO{ data.position(0, 0); TileDataMarker marker = data.newDataMarker(); - Color color = new Color(); for(int y = 0; y < data.height(); y++){ for(int x = 0; x < data.width(); x++){ data.read(marker); + byte elev = y >= data.height() - 1 ? 0 : data.read(x, y + 1, DataPosition.elevation); Block floor = content.block(marker.floor); Block wall = content.block(marker.wall); - int wallc = ColorMapper.getBlockColor(wall); - if(wallc == 0 && (wall.update || wall.solid || wall.breakable)) wallc = Team.all[marker.team].intColor; - wallc = wallc == 0 ? ColorMapper.getBlockColor(floor) : wallc; - if(marker.elevation > 0){ - float scaling = 1f + marker.elevation / 8f; - color.set(wallc); - color.mul(scaling, scaling, scaling, 1f); - wallc = Color.rgba8888(color); - } - pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, wallc); + int color = ColorMapper.colorFor(floor, wall, Team.all[marker.team], marker.elevation, elev > marker.elevation ? (byte)(1 << 6) : (byte)0); + pixmap.drawPixel(x, pixmap.getHeight() - 1 - y, color); } }