mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
updated marbleland support
This commit is contained in:
parent
11052389b1
commit
a2be44157e
5 changed files with 53 additions and 51 deletions
|
|
@ -241,8 +241,7 @@ class DifBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
static var shaderMaterialDict:Map<String, (hxsl.Shader->Void)->Void> = [
|
static var shaderMaterialDict:Map<String, (hxsl.Shader->Void)->Void> = [
|
||||||
'interiors_mbu/plate_1.jpg' => (onFinish) -> createPhongMaterial(onFinish, 'plate.randomize.png', 'plate.normal.png', 8, new Vector(1, 1, 0.8, 1),
|
'interiors_mbu/plate_1.jpg' => (onFinish) -> createPhongMaterial(onFinish, 'plate.randomize.png', 'plate.normal.png', 8, new Vector(1, 1, 0.8, 1), 0.5),
|
||||||
0.5),
|
|
||||||
'interiors_mbu/tile_beginner.png' => (onFinish) -> createNoiseTileMaterial(onFinish, 'tile_beginner.png', '', 40, new Vector(1, 1, 1, 1)),
|
'interiors_mbu/tile_beginner.png' => (onFinish) -> createNoiseTileMaterial(onFinish, 'tile_beginner.png', '', 40, new Vector(1, 1, 1, 1)),
|
||||||
'interiors_mbu/tile_beginner_shadow.png' => (onFinish) -> createNoiseTileMaterial(onFinish, 'tile_beginner.png', '_shadow', 40,
|
'interiors_mbu/tile_beginner_shadow.png' => (onFinish) -> createNoiseTileMaterial(onFinish, 'tile_beginner.png', '_shadow', 40,
|
||||||
new Vector(0.2, 0.2, 0.2, 0.2)),
|
new Vector(0.2, 0.2, 0.2, 0.2)),
|
||||||
|
|
@ -280,8 +279,7 @@ class DifBuilder {
|
||||||
'interiors_mbu/edge_white_shadow.png' => (onFinish) -> createPhongMaterial(onFinish, 'edge_white_shadow.png', 'edge.normal.png', 50,
|
'interiors_mbu/edge_white_shadow.png' => (onFinish) -> createPhongMaterial(onFinish, 'edge_white_shadow.png', 'edge.normal.png', 50,
|
||||||
new Vector(0.2, 0.2, 0.2, 0.2)),
|
new Vector(0.2, 0.2, 0.2, 0.2)),
|
||||||
'interiors_mbu/beam.png' => (onFinish) -> createPhongMaterial(onFinish, 'beam.png', 'beam.normal.png', 12, new Vector(0.8, 0.8, 0.6, 1)),
|
'interiors_mbu/beam.png' => (onFinish) -> createPhongMaterial(onFinish, 'beam.png', 'beam.normal.png', 12, new Vector(0.8, 0.8, 0.6, 1)),
|
||||||
'interiors_mbu/beam_side.png' => (onFinish) -> createPhongMaterial(onFinish, 'beam_side.png', 'beam_side.normal.png', 12,
|
'interiors_mbu/beam_side.png' => (onFinish) -> createPhongMaterial(onFinish, 'beam_side.png', 'beam_side.normal.png', 12, new Vector(0.8, 0.8, 0.6, 1)),
|
||||||
new Vector(0.8, 0.8, 0.6, 1)),
|
|
||||||
'interiors_mbu/friction_low.png' => (onFinish) -> createPhongMaterial(onFinish, 'friction_low.png', 'friction_low.normal.png', 128,
|
'interiors_mbu/friction_low.png' => (onFinish) -> createPhongMaterial(onFinish, 'friction_low.png', 'friction_low.normal.png', 128,
|
||||||
new Vector(1, 1, 1, 0.8)),
|
new Vector(1, 1, 1, 0.8)),
|
||||||
'interiors_mbu/friction_low.jpg' => (onFinish) -> createPhongMaterial(onFinish, 'friction_low.png', 'friction_low.normal.png', 128,
|
'interiors_mbu/friction_low.jpg' => (onFinish) -> createPhongMaterial(onFinish, 'friction_low.png', 'friction_low.normal.png', 128,
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,9 @@ class MarbleWorldMacros {
|
||||||
// Add the correct shape based on type
|
// Add the correct shape based on type
|
||||||
var dataBlockLowerCase = element.datablock.toLowerCase();
|
var dataBlockLowerCase = element.datablock.toLowerCase();
|
||||||
if (dataBlockLowerCase == "") {} // Make sure we don't do anything if there's no data block
|
if (dataBlockLowerCase == "") {} // Make sure we don't do anything if there's no data block
|
||||||
else if (dataBlockLowerCase == "startpad")
|
else if (["startpad", "startpad_mbg", "startpad_mbp"].contains(dataBlockLowerCase))
|
||||||
shape = new StartPad();
|
shape = new StartPad();
|
||||||
else if (dataBlockLowerCase == "endpad") {
|
else if (["endpad", "endpad_mbg", "endpad_mbp"].contains(dataBlockLowerCase)) {
|
||||||
shape = new EndPad();
|
shape = new EndPad();
|
||||||
if (element is MissionElementStaticShape && cast(element, MissionElementStaticShape) == endPadElement)
|
if (element is MissionElementStaticShape && cast(element, MissionElementStaticShape) == endPadElement)
|
||||||
endPad = cast shape;
|
endPad = cast shape;
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ class MarbleWorld extends Scheduler {
|
||||||
// Override the end pad element. We do this because only the last finish pad element will actually do anything.
|
// Override the end pad element. We do this because only the last finish pad element will actually do anything.
|
||||||
if (element._type == MissionElementType.StaticShape) {
|
if (element._type == MissionElementType.StaticShape) {
|
||||||
var so:MissionElementStaticShape = cast element;
|
var so:MissionElementStaticShape = cast element;
|
||||||
if (so.datablock.toLowerCase() == 'endpad')
|
if (["endpad", "endpad_mbg", "endpad_mbp"].contains(so.datablock.toLowerCase()))
|
||||||
this.endPadElement = so;
|
this.endPadElement = so;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,31 +16,18 @@ class Marbleland {
|
||||||
public static var missions:Map<Int, Mission> = [];
|
public static var missions:Map<Int, Mission> = [];
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
Http.get('https://raw.githubusercontent.com/Vanilagy/MarbleBlast/master/src/assets/customs_gold.json', (b) -> {
|
Http.get('https://marbleblast.vaniverse.io/api/customs', (b) -> {
|
||||||
parseMissionList(b.toString(), "gold");
|
parseMissionList(b.toString());
|
||||||
Console.log('Loaded gold customs: ${goldMissions.length}');
|
Console.log('Loaded gold customs: ${goldMissions.length}');
|
||||||
}, (e) -> {});
|
|
||||||
Http.get('https://raw.githubusercontent.com/Vanilagy/MarbleBlast/master/src/assets/customs_ultra.json', (b) -> {
|
|
||||||
parseMissionList(b.toString(), "ultra");
|
|
||||||
Console.log('Loaded ultra customs: ${ultraMissions.length}');
|
Console.log('Loaded ultra customs: ${ultraMissions.length}');
|
||||||
}, (e) -> {});
|
|
||||||
Http.get('https://raw.githubusercontent.com/Vanilagy/MarbleBlast/master/src/assets/customs_platinum.json', (b) -> {
|
|
||||||
parseMissionList(b.toString(), "platinum");
|
|
||||||
Console.log('Loaded platinum customs: ${platinumMissions.length}');
|
Console.log('Loaded platinum customs: ${platinumMissions.length}');
|
||||||
}, (e) -> {});
|
}, (e) -> {
|
||||||
|
Console.log('Error getting custom list from marbleland.');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static function parseMissionList(s:String, game:String) {
|
static function parseMissionList(s:String) {
|
||||||
var claJson:Array<Dynamic> = Json.parse(s);
|
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();
|
var platDupes = new Map();
|
||||||
|
|
||||||
for (missionData in claJson) {
|
for (missionData in claJson) {
|
||||||
|
|
@ -63,6 +50,8 @@ class Marbleland {
|
||||||
mission.hasEgg = missionData.hasEgg;
|
mission.hasEgg = missionData.hasEgg;
|
||||||
mission.isClaMission = true;
|
mission.isClaMission = true;
|
||||||
|
|
||||||
|
var game = missionData.modification;
|
||||||
|
|
||||||
if (game == 'platinum') {
|
if (game == 'platinum') {
|
||||||
if (platDupes.exists(mission.title + mission.description))
|
if (platDupes.exists(mission.title + mission.description))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -83,32 +72,27 @@ class Marbleland {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort according to name
|
// sort according to name
|
||||||
switch (game) {
|
goldMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
||||||
case 'gold':
|
for (i in 0...goldMissions.length - 1) {
|
||||||
goldMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
@:privateAccess goldMissions[i].next = goldMissions[i + 1];
|
||||||
for (i in 0...goldMissions.length - 1) {
|
goldMissions[i].index = i;
|
||||||
@:privateAccess goldMissions[i].next = goldMissions[i + 1];
|
|
||||||
goldMissions[i].index = i;
|
|
||||||
}
|
|
||||||
@:privateAccess goldMissions[goldMissions.length - 1].next = goldMissions[0];
|
|
||||||
goldMissions[goldMissions.length - 1].index = goldMissions.length - 1;
|
|
||||||
case 'platinum':
|
|
||||||
platinumMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
|
||||||
for (i in 0...platinumMissions.length - 1) {
|
|
||||||
@:privateAccess platinumMissions[i].next = platinumMissions[i + 1];
|
|
||||||
platinumMissions[i].index = i;
|
|
||||||
}
|
|
||||||
@:privateAccess platinumMissions[platinumMissions.length - 1].next = platinumMissions[0];
|
|
||||||
platinumMissions[platinumMissions.length - 1].index = platinumMissions.length - 1;
|
|
||||||
case 'ultra':
|
|
||||||
ultraMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
|
||||||
for (i in 0...ultraMissions.length - 1) {
|
|
||||||
@:privateAccess ultraMissions[i].next = ultraMissions[i + 1];
|
|
||||||
ultraMissions[i].index = i;
|
|
||||||
}
|
|
||||||
@:privateAccess ultraMissions[ultraMissions.length - 1].next = ultraMissions[0];
|
|
||||||
ultraMissions[ultraMissions.length - 1].index = ultraMissions.length - 1;
|
|
||||||
}
|
}
|
||||||
|
@:privateAccess goldMissions[goldMissions.length - 1].next = goldMissions[0];
|
||||||
|
goldMissions[goldMissions.length - 1].index = goldMissions.length - 1;
|
||||||
|
platinumMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
||||||
|
for (i in 0...platinumMissions.length - 1) {
|
||||||
|
@:privateAccess platinumMissions[i].next = platinumMissions[i + 1];
|
||||||
|
platinumMissions[i].index = i;
|
||||||
|
}
|
||||||
|
@:privateAccess platinumMissions[platinumMissions.length - 1].next = platinumMissions[0];
|
||||||
|
platinumMissions[platinumMissions.length - 1].index = platinumMissions.length - 1;
|
||||||
|
ultraMissions.sort((x, y) -> x.title > y.title ? 1 : (x.title < y.title ? -1 : 0));
|
||||||
|
for (i in 0...ultraMissions.length - 1) {
|
||||||
|
@:privateAccess ultraMissions[i].next = ultraMissions[i + 1];
|
||||||
|
ultraMissions[i].index = i;
|
||||||
|
}
|
||||||
|
@:privateAccess ultraMissions[ultraMissions.length - 1].next = ultraMissions[0];
|
||||||
|
ultraMissions[ultraMissions.length - 1].index = ultraMissions.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMissionImage(id:Int, cb:Image->Void) {
|
public static function getMissionImage(id:Int, cb:Image->Void) {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import src.ParticleSystem.ParticleData;
|
||||||
import h3d.Vector;
|
import h3d.Vector;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import src.MarbleWorld;
|
import src.MarbleWorld;
|
||||||
|
import src.MarbleGame;
|
||||||
|
|
||||||
final landMineParticle:ParticleEmitterOptions = {
|
final landMineParticle:ParticleEmitterOptions = {
|
||||||
ejectionPeriod: 2,
|
ejectionPeriod: 2,
|
||||||
|
|
@ -96,6 +97,8 @@ class LandMine extends DtsObject {
|
||||||
var landMineSmokeParticleData:ParticleData;
|
var landMineSmokeParticleData:ParticleData;
|
||||||
var landMineSparkParticleData:ParticleData;
|
var landMineSparkParticleData:ParticleData;
|
||||||
|
|
||||||
|
var light:h3d.scene.fwd.PointLight;
|
||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
dtsPath = "data/shapes/hazards/landmine.dts";
|
dtsPath = "data/shapes/hazards/landmine.dts";
|
||||||
|
|
@ -142,6 +145,10 @@ class LandMine extends DtsObject {
|
||||||
var impulse = off.normalized().multiply(strength);
|
var impulse = off.normalized().multiply(strength);
|
||||||
marble.applyImpulse(impulse);
|
marble.applyImpulse(impulse);
|
||||||
|
|
||||||
|
// light = new h3d.scene.fwd.PointLight(MarbleGame.instance.scene);
|
||||||
|
// light.setPosition(minePos.x, minePos.y, minePos.z);
|
||||||
|
// light.enableSpecular = false;
|
||||||
|
|
||||||
// for (collider in this.colliders) {
|
// for (collider in this.colliders) {
|
||||||
// var hull:CollisionHull = cast collider;
|
// var hull:CollisionHull = cast collider;
|
||||||
// hull.force = strength;
|
// hull.force = strength;
|
||||||
|
|
@ -174,6 +181,19 @@ class LandMine extends DtsObject {
|
||||||
this.setHide(true);
|
this.setHide(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (light != null) {
|
||||||
|
// var t = Util.clamp((timeState.timeSinceLoad - this.disappearTime) / 1.2, 0, 1);
|
||||||
|
|
||||||
|
// light.color = Util.lerpThreeVectors(new Vector(0.5, 0.5, 0), new Vector(0, 0, 0), t);
|
||||||
|
// var radius = Util.lerp(6, 3, t);
|
||||||
|
// light.params = new Vector(0, 1 / radius, 0);
|
||||||
|
|
||||||
|
// if (t >= 1) {
|
||||||
|
// light.remove();
|
||||||
|
// light = null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
var opacity = Util.clamp((timeState.timeSinceLoad - (this.disappearTime + 5)), 0, 1);
|
var opacity = Util.clamp((timeState.timeSinceLoad - (this.disappearTime + 5)), 0, 1);
|
||||||
this.setOpacity(opacity);
|
this.setOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue