mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fixes
This commit is contained in:
parent
4bc6e0b8fb
commit
acde6595cb
10 changed files with 29 additions and 164 deletions
|
|
@ -4,7 +4,6 @@ import haxe.Json;
|
|||
import src.Util;
|
||||
import src.Settings;
|
||||
import src.Http;
|
||||
import src.Console;
|
||||
|
||||
typedef PayloadData = {
|
||||
type:String,
|
||||
|
|
@ -44,14 +43,12 @@ class Analytics {
|
|||
});
|
||||
}
|
||||
|
||||
public static function trackLevelScore(levelName:String, levelFile:String, time:Int, oobs:Int, respawns:Int, rewind:Bool) {
|
||||
public static function trackLevelScore(levelName:String, levelFile:String, time:Int, rewind:Bool) {
|
||||
var p = payload("level-score", {
|
||||
level_play: Json.stringify({
|
||||
name: levelName,
|
||||
file: levelFile,
|
||||
time: time,
|
||||
oobs: oobs,
|
||||
respawns: respawns,
|
||||
rewind: rewind
|
||||
})
|
||||
});
|
||||
|
|
@ -63,14 +60,12 @@ class Analytics {
|
|||
});
|
||||
}
|
||||
|
||||
public static function trackLevelQuit(levelName:String, levelFile:String, time:Int, oobs:Int, respawns:Int, rewind:Bool) {
|
||||
public static function trackLevelQuit(levelName:String, levelFile:String, time:Int, rewind:Bool) {
|
||||
var p = payload("level-quit", {
|
||||
level_quit: Json.stringify({
|
||||
name: levelName,
|
||||
file: levelFile,
|
||||
time: time,
|
||||
oobs: oobs,
|
||||
respawns: respawns,
|
||||
rewind: rewind
|
||||
})
|
||||
});
|
||||
|
|
@ -103,9 +98,9 @@ class Analytics {
|
|||
language: language(),
|
||||
referrer: referrer(),
|
||||
screen: screen(),
|
||||
title: "MBHaxe Platinum",
|
||||
title: "MBHaxe Gold",
|
||||
url: "/",
|
||||
website: "e6da43f0-fc6a-49cb-a4a9-4b7e7745e538",
|
||||
website: "737bbe05-ad2e-43a5-820b-4e3014f5683e",
|
||||
name: eventName
|
||||
}
|
||||
};
|
||||
|
|
@ -120,7 +115,7 @@ class Analytics {
|
|||
return js.Browser.window.location.hostname;
|
||||
#end
|
||||
#if hl
|
||||
return "marbleblast.randomityguy.me";
|
||||
return "marbleblastgold.randomityguy.me";
|
||||
#end
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,8 +167,6 @@ class DifBuilder {
|
|||
colliderSurface.normals = [];
|
||||
colliderSurface.indices = [];
|
||||
colliderSurface.transformKeys = [];
|
||||
colliderSurface.edgeData = [];
|
||||
colliderSurface.edgeConcavities = [];
|
||||
colliderSurface.originalIndices = [];
|
||||
colliderSurface.originalSurfaceIndex = surfaceindex;
|
||||
|
||||
|
|
@ -243,12 +241,12 @@ class DifBuilder {
|
|||
colliderSurface.friction = minfo.friction;
|
||||
colliderSurface.restitution = minfo.restitution;
|
||||
}
|
||||
colliderSurface.points.push(new Vector(-p1.x, p1.y, p1.z));
|
||||
colliderSurface.points.push(new Vector(-p2.x, p2.y, p2.z));
|
||||
colliderSurface.points.push(new Vector(-p3.x, p3.y, p3.z));
|
||||
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
|
||||
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
|
||||
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
|
||||
colliderSurface.addPoint(-p1.x, p1.y, p1.z);
|
||||
colliderSurface.addPoint(-p2.x, p2.y, p2.z);
|
||||
colliderSurface.addPoint(-p3.x, p3.y, p3.z);
|
||||
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
|
||||
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
|
||||
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
|
||||
colliderSurface.indices.push(colliderSurface.indices.length);
|
||||
colliderSurface.indices.push(colliderSurface.indices.length);
|
||||
colliderSurface.indices.push(colliderSurface.indices.length);
|
||||
|
|
@ -405,52 +403,6 @@ class DifBuilder {
|
|||
return vec;
|
||||
}
|
||||
|
||||
for (colliderSurface in colliderSurfaces) {
|
||||
var i = 0;
|
||||
while (i < colliderSurface.indices.length) {
|
||||
var e1e2 = hashEdge(colliderSurface.originalIndices[i], colliderSurface.originalIndices[i + 1]);
|
||||
var e2e3 = hashEdge(colliderSurface.originalIndices[i + 1], colliderSurface.originalIndices[i + 2]);
|
||||
var e1e3 = hashEdge(colliderSurface.originalIndices[i], colliderSurface.originalIndices[i + 2]);
|
||||
|
||||
var edgeData = 0;
|
||||
if (difEdges.exists(e1e2)) {
|
||||
// if (getEdgeDot(difEdges[e1e2]) < Math.cos(Math.PI / 12)) {
|
||||
edgeData |= 1;
|
||||
// }
|
||||
colliderSurface.edgeConcavities.push(getEdgeConcavity(difEdges[e1e2]));
|
||||
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e1e2]));
|
||||
} else {
|
||||
colliderSurface.edgeConcavities.push(false);
|
||||
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
|
||||
}
|
||||
if (difEdges.exists(e2e3)) {
|
||||
// if (getEdgeDot(difEdges[e2e3]) < Math.cos(Math.PI / 12)) {
|
||||
edgeData |= 2;
|
||||
// }
|
||||
colliderSurface.edgeConcavities.push(getEdgeConcavity(difEdges[e2e3]));
|
||||
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e2e3]));
|
||||
// colliderSurface.edgeDots.push(dot);
|
||||
} else {
|
||||
colliderSurface.edgeConcavities.push(false);
|
||||
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
|
||||
}
|
||||
if (difEdges.exists(e1e3)) {
|
||||
// if (getEdgeDot(difEdges[e1e3]) < Math.cos(Math.PI / 12)) {
|
||||
edgeData |= 4;
|
||||
// }
|
||||
colliderSurface.edgeConcavities.push(getEdgeConcavity(difEdges[e1e3]));
|
||||
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e1e3]));
|
||||
// colliderSurface.edgeDots.push(dot);
|
||||
} else {
|
||||
colliderSurface.edgeConcavities.push(false);
|
||||
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
|
||||
}
|
||||
|
||||
colliderSurface.edgeData.push(edgeData);
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
for (vtex => buckets in vertexBuckets) {
|
||||
for (i in 0...buckets.length) {
|
||||
var bucket = buckets[i];
|
||||
|
|
@ -483,7 +435,6 @@ class DifBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
collider.difEdgeMap = difEdges;
|
||||
collider.finalize();
|
||||
itr.collider = collider;
|
||||
|
||||
|
|
|
|||
|
|
@ -560,11 +560,11 @@ class DtsObject extends GameObject {
|
|||
|
||||
for (index in [i1, i2, i3]) {
|
||||
var vertex = vertices[index];
|
||||
hs.points.push(new Vector(vertex.x, vertex.y, vertex.z));
|
||||
hs.addPoint(vertex.x, vertex.y, vertex.z);
|
||||
hs.transformKeys.push(0);
|
||||
|
||||
var normal = vertexNormals[index];
|
||||
hs.normals.push(new Vector(normal.x, normal.y, normal.z));
|
||||
hs.addNormal(normal.x, normal.y, normal.z);
|
||||
}
|
||||
|
||||
hs.indices.push(hs.indices.length);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package src;
|
||||
|
||||
import src.Console;
|
||||
import src.Util;
|
||||
|
||||
typedef HttpRequest = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package;
|
||||
|
||||
import src.Http;
|
||||
import hxd.Key;
|
||||
import src.Util;
|
||||
import src.ResourceLoader;
|
||||
|
|
@ -18,6 +19,7 @@ import h2d.Text;
|
|||
import h3d.Vector;
|
||||
import src.ProfilerUI;
|
||||
import src.Gamepad;
|
||||
import src.Http;
|
||||
|
||||
class Main extends hxd.App {
|
||||
var marbleGame:MarbleGame;
|
||||
|
|
@ -60,6 +62,7 @@ class Main extends hxd.App {
|
|||
trace("ResourceLoader::init");
|
||||
ResourceLoader.init(s2d, () -> {
|
||||
trace("Settings::init");
|
||||
Http.init();
|
||||
Settings.init();
|
||||
trace("Gamepad::init");
|
||||
Gamepad.init();
|
||||
|
|
|
|||
|
|
@ -1131,8 +1131,7 @@ class Marble extends GameObject {
|
|||
continue;
|
||||
}
|
||||
|
||||
var tsi = Collision.TriangleSphereIntersection(testTri.v[0], testTri.v[1], testTri.v[2], testTri.n, position, radius, testTri.edge,
|
||||
testTri.concavity);
|
||||
var tsi = Collision.TriangleSphereIntersection(testTri.v[0], testTri.v[1], testTri.v[2], testTri.n, position, radius);
|
||||
if (tsi.result) {
|
||||
var separatingDistance = position.sub(tsi.point).normalized();
|
||||
var distToContactPlane = tsi.point.distance(position);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import src.Util;
|
|||
import src.ProfilerUI;
|
||||
import src.Gamepad;
|
||||
import src.Analytics;
|
||||
import src.Settings;
|
||||
|
||||
@:publicFields
|
||||
class MarbleGame {
|
||||
|
|
@ -224,15 +225,7 @@ class MarbleGame {
|
|||
|
||||
public function quitMission() {
|
||||
world.setCursorLock(false);
|
||||
if (!Settings.levelStatistics.exists(world.mission.path)) {
|
||||
Settings.levelStatistics.set(world.mission.path, {
|
||||
oobs: 0,
|
||||
respawns: 0,
|
||||
totalTime: 0,
|
||||
});
|
||||
}
|
||||
var stats = Settings.levelStatistics[world.mission.path];
|
||||
Analytics.trackLevelQuit(world.mission.title, world.mission.path, Std.int(world.timeState.timeSinceLoad * 1000), stats.oobs, stats.respawns,
|
||||
Analytics.trackLevelQuit(world.mission.title, world.mission.path, Std.int(world.timeState.timeSinceLoad * 1000),
|
||||
Settings.optionsSettings.rewindEnabled);
|
||||
paused = false;
|
||||
var pmg = new PlayMissionGui();
|
||||
|
|
@ -258,6 +251,9 @@ class MarbleGame {
|
|||
|
||||
public function watchMissionReplay(mission:Mission, replay:Replay) {
|
||||
canvas.clearContent();
|
||||
if (world != null) {
|
||||
world.dispose();
|
||||
}
|
||||
Analytics.trackSingle("replay-watch");
|
||||
world = new MarbleWorld(scene, scene2d, mission);
|
||||
world.replay = replay;
|
||||
|
|
|
|||
|
|
@ -1336,15 +1336,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.finishYaw = this.marble.camera.CameraYaw;
|
||||
this.finishPitch = this.marble.camera.CameraPitch;
|
||||
displayAlert("Congratulations! You've finished!");
|
||||
if (!Settings.levelStatistics.exists(mission.path)) {
|
||||
Settings.levelStatistics.set(mission.path, {
|
||||
oobs: 0,
|
||||
respawns: 0,
|
||||
totalTime: 0,
|
||||
});
|
||||
}
|
||||
Analytics.trackLevelScore(mission.title, mission.path, Std.int(finishTime.gameplayClock * 1000), Settings.levelStatistics[mission.path].oobs,
|
||||
Settings.levelStatistics[mission.path].respawns, Settings.optionsSettings.rewindEnabled);
|
||||
Analytics.trackLevelScore(mission.title, mission.path, Std.int(finishTime.gameplayClock * 1000), Settings.optionsSettings.rewindEnabled);
|
||||
if (!this.isWatching)
|
||||
this.schedule(this.timeState.currentAttemptTime + 2, () -> cast showFinishScreen());
|
||||
// Stop the ongoing sounds
|
||||
|
|
@ -1578,7 +1570,6 @@ class MarbleWorld extends Scheduler {
|
|||
for (textureResource in this.textureResources) {
|
||||
textureResource.release();
|
||||
}
|
||||
gems = null;
|
||||
|
||||
sky.dispose();
|
||||
sky = null;
|
||||
|
|
@ -1586,11 +1577,8 @@ class MarbleWorld extends Scheduler {
|
|||
collisionWorld.dispose();
|
||||
collisionWorld = null;
|
||||
particleManager = null;
|
||||
namedObjects = null;
|
||||
shapeOrTriggerInside = null;
|
||||
shapeImmunity = null;
|
||||
currentCheckpoint = null;
|
||||
checkpointCollectedGems = null;
|
||||
marble = null;
|
||||
|
||||
this._disposed = true;
|
||||
|
|
|
|||
|
|
@ -116,25 +116,9 @@ class RewindFrame {
|
|||
framesize += 1; // s.lastDirection
|
||||
framesize += 8; // s.lastCompletion
|
||||
}
|
||||
framesize += 8; // blastAmt
|
||||
if (oobState.oob)
|
||||
framesize += 1; // oobState.oob
|
||||
framesize += 32; // oobState.timeState
|
||||
framesize += 1; // Null<checkpointState>
|
||||
if (checkpointState != null) {
|
||||
framesize += 4; // checkpointState.currentCheckpoint
|
||||
}
|
||||
framesize += 2; // checkpointState.currentCheckpointTrigger
|
||||
framesize += 2; // checkpointState.checkpointCollectedGems.length
|
||||
for (gem in checkpointState.checkpointCollectedGems.keys()) {
|
||||
framesize += 2; // gem
|
||||
framesize += 1; // checkpointState.checkpointCollectedGems[gem]
|
||||
}
|
||||
framesize += 2; // checkpointState.checkpointHeldPowerup
|
||||
framesize += 1; // Null<checkpointState.checkpointUp>
|
||||
if (checkpointState.checkpointUp != null)
|
||||
framesize += 24; // checkpointState.checkpointUp
|
||||
framesize += 8; // checkpointState.checkpointBlast
|
||||
bb.prepare(framesize);
|
||||
// Now actually write
|
||||
bb.writeDouble(timeState.currentAttemptTime);
|
||||
|
|
@ -197,7 +181,6 @@ class RewindFrame {
|
|||
bb.writeByte(s.lastDirection);
|
||||
bb.writeDouble(s.lastCompletion);
|
||||
}
|
||||
bb.writeDouble(blastAmt);
|
||||
bb.writeByte(oobState.oob ? 1 : 0);
|
||||
if (oobState.oob) {
|
||||
bb.writeDouble(oobState.timeState.currentAttemptTime);
|
||||
|
|
@ -205,29 +188,6 @@ class RewindFrame {
|
|||
bb.writeDouble(oobState.timeState.gameplayClock);
|
||||
bb.writeDouble(oobState.timeState.dt);
|
||||
}
|
||||
bb.writeByte(checkpointState.currentCheckpoint == null ? 0 : 1);
|
||||
if (checkpointState.currentCheckpoint != null) {
|
||||
bb.writeInt16(rm.allocGO(checkpointState.currentCheckpoint.obj));
|
||||
bb.writeInt16(rm.allocME(checkpointState.currentCheckpoint.elem));
|
||||
}
|
||||
bb.writeInt16(rm.allocGO(checkpointState.currentCheckpointTrigger));
|
||||
var chkgemcount = 0;
|
||||
for (g in checkpointState.checkpointCollectedGems) {
|
||||
chkgemcount++;
|
||||
}
|
||||
bb.writeInt16(chkgemcount);
|
||||
for (gem in checkpointState.checkpointCollectedGems.keys()) {
|
||||
bb.writeInt16(rm.allocGO(gem));
|
||||
bb.writeByte(checkpointState.checkpointCollectedGems[gem] ? 1 : 0);
|
||||
}
|
||||
bb.writeInt16(rm.allocGO(checkpointState.checkpointHeldPowerup));
|
||||
bb.writeByte(checkpointState.checkpointUp == null ? 0 : 1);
|
||||
if (checkpointState.checkpointUp != null) {
|
||||
bb.writeDouble(checkpointState.checkpointUp.x);
|
||||
bb.writeDouble(checkpointState.checkpointUp.y);
|
||||
bb.writeDouble(checkpointState.checkpointUp.z);
|
||||
}
|
||||
bb.writeDouble(checkpointState.checkpointBlast);
|
||||
return bb.getBytes();
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +281,6 @@ class RewindFrame {
|
|||
trapdoorStates_item.lastCompletion = br.readDouble();
|
||||
trapdoorStates.push(trapdoorStates_item);
|
||||
}
|
||||
blastAmt = br.readDouble();
|
||||
oobState = {
|
||||
oob: br.readByte() != 0,
|
||||
timeState: null
|
||||
|
|
@ -333,35 +292,5 @@ class RewindFrame {
|
|||
oobState.timeState.gameplayClock = br.readDouble();
|
||||
oobState.timeState.dt = br.readDouble();
|
||||
}
|
||||
var hasCheckpoint = br.readByte() != 0;
|
||||
checkpointState = {
|
||||
currentCheckpoint: null,
|
||||
currentCheckpointTrigger: null,
|
||||
checkpointCollectedGems: new Map<Gem, Bool>(),
|
||||
checkpointHeldPowerup: null,
|
||||
checkpointUp: null,
|
||||
checkpointBlast: 0.0,
|
||||
};
|
||||
if (hasCheckpoint) {
|
||||
var co = rm.getGO(br.readInt16());
|
||||
var ce = rm.getME(br.readInt16());
|
||||
checkpointState.currentCheckpoint = {obj: cast co, elem: ce};
|
||||
}
|
||||
checkpointState.currentCheckpointTrigger = cast rm.getGO(br.readInt16());
|
||||
var checkpointState_checkpointCollectedGems_len = br.readInt16();
|
||||
for (i in 0...checkpointState_checkpointCollectedGems_len) {
|
||||
var gem = cast rm.getGO(br.readInt16());
|
||||
var c = br.readByte() != 0;
|
||||
checkpointState.checkpointCollectedGems.set(cast gem, c);
|
||||
}
|
||||
checkpointState.checkpointHeldPowerup = cast rm.getGO(br.readInt16());
|
||||
var checkpointState_checkpointUp_has = br.readByte() != 0;
|
||||
if (checkpointState_checkpointUp_has) {
|
||||
checkpointState.checkpointUp = new Vector();
|
||||
checkpointState.checkpointUp.x = br.readDouble();
|
||||
checkpointState.checkpointUp.y = br.readDouble();
|
||||
checkpointState.checkpointUp.z = br.readDouble();
|
||||
}
|
||||
checkpointState.checkpointBlast = br.readDouble();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,12 @@ class RewindManager {
|
|||
oob: level.outOfBounds,
|
||||
timeState: level.outOfBoundsTime != null ? level.outOfBoundsTime.clone() : null
|
||||
};
|
||||
frames.push(rf);
|
||||
frameElapsedTimes.push(level.timeState.currentAttemptTime);
|
||||
frameDataOffsets.push(frameData.length);
|
||||
var frameDataSerialized = rf.serialize(this);
|
||||
frameSizes.push(frameDataSerialized.length);
|
||||
frameData.addBytes(frameDataSerialized, 0, frameDataSerialized.length);
|
||||
// frames.push(rf);
|
||||
}
|
||||
|
||||
public function applyFrame(rf:RewindFrame) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue