Double outline check
This commit is contained in:
@@ -51,7 +51,7 @@ public class StatusEffects{
|
|||||||
|
|
||||||
unmoving = new StatusEffect("unmoving"){{
|
unmoving = new StatusEffect("unmoving"){{
|
||||||
color = Pal.gray;
|
color = Pal.gray;
|
||||||
speedMultiplier = 0.001f;
|
speedMultiplier = 0f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
slow = new StatusEffect("slow"){{
|
slow = new StatusEffect("slow"){{
|
||||||
|
|||||||
@@ -100,16 +100,19 @@ public abstract class UnlockableContent extends MappableContent{
|
|||||||
if(region instanceof AtlasRegion at && region.found()){
|
if(region instanceof AtlasRegion at && region.found()){
|
||||||
String name = at.name;
|
String name = at.name;
|
||||||
if(!makeNew || !packer.has(name + "-outline")){
|
if(!makeNew || !packer.has(name + "-outline")){
|
||||||
PixmapRegion base = Core.atlas.getPixmap(region);
|
String regName = name + (makeNew ? "-outline" : "");
|
||||||
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
|
if(packer.registerOutlined(regName)){
|
||||||
Drawf.checkBleed(result);
|
PixmapRegion base = Core.atlas.getPixmap(region);
|
||||||
packer.add(page, name + (makeNew ? "-outline" : ""), result);
|
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){
|
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);
|
PixmapRegion base = Core.atlas.getPixmap(region);
|
||||||
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
|
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
|
||||||
Drawf.checkBleed(result);
|
Drawf.checkBleed(result);
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package mindustry.graphics;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.Texture.*;
|
import arc.graphics.Texture.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.Log.*;
|
import arc.util.Log.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
|
|
||||||
public class MultiPacker implements Disposable{
|
public class MultiPacker implements Disposable{
|
||||||
private PixmapPacker[] packers = new PixmapPacker[PageType.all.length];
|
private PixmapPacker[] packers = new PixmapPacker[PageType.all.length];
|
||||||
|
private ObjectSet<String> outlined = new ObjectSet<>();
|
||||||
|
|
||||||
public MultiPacker(){
|
public MultiPacker(){
|
||||||
for(int i = 0; i < packers.length; i++){
|
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){
|
public PixmapPacker getPacker(PageType type){
|
||||||
return packers[type.ordinal()];
|
return packers[type.ordinal()];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -883,6 +883,12 @@ public class UnitType extends UnlockableContent{
|
|||||||
makeOutline(PageType.main, packer, outlineTarget, alwaysCreateOutline && region == outlineTarget, outlineColor, outlineRadius);
|
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){
|
for(Weapon weapon : weapons){
|
||||||
if(!weapon.name.isEmpty()){
|
if(!weapon.name.isEmpty()){
|
||||||
//TODO makeNew isn't really necessary here is it
|
//TODO makeNew isn't really necessary here is it
|
||||||
|
|||||||
Reference in New Issue
Block a user