Double outline check

This commit is contained in:
Anuken
2022-06-14 10:54:56 -04:00
parent ce27388fad
commit 697df9d9f1
4 changed files with 26 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ public class StatusEffects{
unmoving = new StatusEffect("unmoving"){{
color = Pal.gray;
speedMultiplier = 0.001f;
speedMultiplier = 0f;
}};
slow = new StatusEffect("slow"){{

View File

@@ -100,16 +100,19 @@ public abstract class UnlockableContent extends MappableContent{
if(region instanceof AtlasRegion at && region.found()){
String name = at.name;
if(!makeNew || !packer.has(name + "-outline")){
PixmapRegion base = Core.atlas.getPixmap(region);
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
Drawf.checkBleed(result);
packer.add(page, name + (makeNew ? "-outline" : ""), result);
String regName = name + (makeNew ? "-outline" : "");
if(packer.registerOutlined(regName)){
PixmapRegion base = Core.atlas.getPixmap(region);
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
Drawf.checkBleed(result);
packer.add(page, regName, result);
}
}
}
}
protected void makeOutline(MultiPacker packer, TextureRegion region, String name, Color outlineColor, int outlineRadius){
if(region.found()){
if(region.found() && packer.registerOutlined(name)){
PixmapRegion base = Core.atlas.getPixmap(region);
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
Drawf.checkBleed(result);

View File

@@ -3,12 +3,14 @@ package mindustry.graphics;
import arc.graphics.*;
import arc.graphics.Texture.*;
import arc.graphics.g2d.*;
import arc.struct.*;
import arc.util.*;
import arc.util.Log.*;
import mindustry.*;
public class MultiPacker implements Disposable{
private PixmapPacker[] packers = new PixmapPacker[PageType.all.length];
private ObjectSet<String> outlined = new ObjectSet<>();
public MultiPacker(){
for(int i = 0; i < packers.length; i++){
@@ -48,6 +50,15 @@ public class MultiPacker implements Disposable{
}
}
/** @return whether this image was not already outlined. */
public boolean registerOutlined(String named){
return outlined.add(named);
}
public boolean isOutlined(String name){
return outlined.contains(name);
}
public PixmapPacker getPacker(PageType type){
return packers[type.ordinal()];
}

View File

@@ -883,6 +883,12 @@ public class UnitType extends UnlockableContent{
makeOutline(PageType.main, packer, outlineTarget, alwaysCreateOutline && region == outlineTarget, outlineColor, outlineRadius);
}
if(sample instanceof Crawlc){
for(int i = 0; i < segments; i++){
makeOutline(packer, segmentRegions[i], name + "-segment-outline" + i, outlineColor, outlineRadius);
}
}
for(Weapon weapon : weapons){
if(!weapon.name.isEmpty()){
//TODO makeNew isn't really necessary here is it