fix terrible textures

This commit is contained in:
RandomityGuy 2023-02-10 12:38:50 +05:30
parent 018b4d8705
commit 81dcfd5119
3 changed files with 33 additions and 2 deletions

View file

@ -729,7 +729,7 @@ class DifBuilder {
var material:Material;
var texture:Texture;
if (canFindTex(grp)) {
texture = ResourceLoader.getTexture(tex(grp)).resource;
texture = ResourceLoader.getTextureRealpath(tex(grp)).resource; // ResourceLoader.getTexture(tex(grp), false).resource;
texture.wrap = Wrap.Repeat;
texture.mipMap = Nearest;
var exactName = StringTools.replace(texture.name, "data/", "");

View file

@ -28,6 +28,16 @@ class Marbleland {
static function parseMissionList(s:String, game:String) {
var claJson:Array<Dynamic> = Json.parse(s);
if (game == 'gold') {
claJson = claJson.filter(x -> x.modification == 'gold');
}
if (game == 'platinum') {
claJson = claJson.filter(x -> x.gameType == 'single' && (x.gameMode == null || x.gameMode == 'null' || x.gamemode == ''));
}
if (game == 'ultra') {
claJson = claJson.filter(x -> x.gameType == 'single');
}
var platDupes = new Map();
for (missionData in claJson) {
var mission = new Mission();
@ -49,6 +59,13 @@ class Marbleland {
mission.hasEgg = missionData.hasEgg;
mission.isClaMission = true;
if (game == 'platinum') {
if (platDupes.exists(mission.title + mission.description))
continue;
else
platDupes.set(mission.title + mission.description, true);
}
switch (game) {
case 'gold':
goldMissions.push(mission);
@ -58,6 +75,16 @@ class Marbleland {
platinumMissions.push(mission);
}
}
// sort according to name
switch (game) {
case 'gold':
goldMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
case 'platinum':
platinumMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
case 'ultra':
ultraMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
}
}
public static function getMissionImage(id:Int, cb:Image->Void) {
@ -70,7 +97,7 @@ class Marbleland {
}
public static function download(id:Int, cb:Array<haxe.zip.Entry>->Void) {
Http.get('https://marbleblast.vani.ga/api/custom/${id}.zip', (zipData -> {
Http.get('https://marbleblast.vani.ga/api/custom/${id}.zip?assuming=none', (zipData -> {
var reader = new Reader(new BytesInput(zipData));
var entries:Array<haxe.zip.Entry> = null;
try {

View file

@ -324,6 +324,10 @@ class ResourceLoader {
public static function getTexture(path:String) {
path = getProperFilepath(path);
return getTextureRealpath(path);
}
public static function getTextureRealpath(path:String) {
if (zipFilesystem.exists(path.toLowerCase())) {
var img = new hxd.res.Image(zipFilesystem.get(path.toLowerCase()));
Image.setupTextureFlags = (texObj) -> {