do the fixes

This commit is contained in:
RandomityGuy 2023-07-16 19:20:19 +05:30
parent 4e20125a2d
commit 2f81f5e137
4 changed files with 19 additions and 14 deletions

View file

@ -1078,7 +1078,7 @@ class MarbleWorld extends Scheduler {
if (this.outOfBounds if (this.outOfBounds
&& this.finishTime == null && this.finishTime == null
&& (Key.isDown(Settings.controlsSettings.powerup) || Gamepad.isDown(Settings.gamepadSettings.powerup)) && (Key.isDown(Settings.controlsSettings.jump) || Gamepad.isDown(Settings.gamepadSettings.jump))
&& !this.isWatching) { && !this.isWatching) {
this.restart(); this.restart();
return; return;
@ -1549,8 +1549,10 @@ class MarbleWorld extends Scheduler {
/** Get the current interpolated orientation quaternion. */ /** Get the current interpolated orientation quaternion. */
public function getOrientationQuat(time:Float) { public function getOrientationQuat(time:Float) {
var completion = Util.clamp((time - this.orientationChangeTime) / 0.8, 0, 1); var completion = Util.clamp((time - this.orientationChangeTime) / 0.8, 0, 1);
var newDt = completion / 0.4 * 2.302585124969482; var newDt = completion / 0.15;
var smooth = 1.0 / (newDt * (newDt * 0.235 * newDt) + newDt + 1.0 + 0.48 * newDt * newDt); var smooth = 1.0 / (newDt * (newDt * 0.235 * newDt) + newDt + 1.0 + 0.48 * newDt * newDt);
if (completion > 0.9)
smooth = Util.lerp(25.0 / 1876.0, 0, (completion - 0.9) * 10);
var q = this.oldOrientationQuat.clone(); var q = this.oldOrientationQuat.clone();
q.slerp(q, this.newOrientationQuat, 1 - smooth); q.slerp(q, this.newOrientationQuat, 1 - smooth);
return q; return q;
@ -1641,10 +1643,8 @@ class MarbleWorld extends Scheduler {
/** Sets a new active checkpoint. */ /** Sets a new active checkpoint. */
public function saveCheckpointState(shape:DtsObject, trigger:CheckpointTrigger = null) { public function saveCheckpointState(shape:DtsObject, trigger:CheckpointTrigger = null) {
if (this.currentCheckpoint != null)
if (this.currentCheckpoint == shape)
return false;
var disableOob = false; var disableOob = false;
var isSame = this.currentCheckpoint == shape;
if (trigger != null) { if (trigger != null) {
disableOob = trigger.disableOOB; disableOob = trigger.disableOOB;
if (checkpointSequence > trigger.seqNum) if (checkpointSequence > trigger.seqNum)
@ -1664,7 +1664,9 @@ class MarbleWorld extends Scheduler {
this.checkpointCollectedGems.set(gem, true); this.checkpointCollectedGems.set(gem, true);
} }
this.checkpointHeldPowerup = this.marble.heldPowerup; this.checkpointHeldPowerup = this.marble.heldPowerup;
if (!isSame) {
AudioManager.playSound(ResourceLoader.getResource('data/sound/checkpoint.wav', ResourceLoader.getAudio, this.soundResources)); AudioManager.playSound(ResourceLoader.getResource('data/sound/checkpoint.wav', ResourceLoader.getAudio, this.soundResources));
}
return true; return true;
} }

View file

@ -148,12 +148,12 @@ class Settings {
camRight: Key.RIGHT, camRight: Key.RIGHT,
jump: Key.SPACE, jump: Key.SPACE,
powerup: Key.MOUSE_LEFT, powerup: Key.MOUSE_LEFT,
freelook: Key.MOUSE_RIGHT, freelook: Key.MOUSE_MIDDLE,
alwaysFreeLook: true, alwaysFreeLook: true,
cameraSensitivity: 0.6, cameraSensitivity: 0.6,
invertYAxis: false, invertYAxis: false,
respawn: Key.BACKSPACE, respawn: Key.BACKSPACE,
blast: Key.E, blast: Key.MOUSE_RIGHT,
rewind: Key.R, rewind: Key.R,
}; };

View file

@ -119,11 +119,10 @@ class CollisionWorld {
public function removeMovingEntity(entity:CollisionEntity) { public function removeMovingEntity(entity:CollisionEntity) {
this.dynamicEntities.remove(entity); this.dynamicEntities.remove(entity);
this.dynamicOctree.remove(entity);
this.dynamicEntitySet.remove(entity);
} }
public function updateTransform(entity:CollisionEntity) { public function updateTransform(entity:CollisionEntity) {
this.octree.update(entity); this.octree.update(entity);
this.dynamicBVH.update();
} }
} }

View file

@ -36,7 +36,10 @@ class CheckpointTrigger extends Trigger {
if (shape.length == 0) if (shape.length == 0)
return; return;
var chk:Checkpoint = cast shape[0]; var chk:Checkpoint = cast shape[0];
var prevChk = @:privateAccess this.level.currentCheckpoint;
var issame = prevChk == chk;
if (this.level.saveCheckpointState(chk, this)) { if (this.level.saveCheckpointState(chk, this)) {
if (!issame) {
chk.lastActivatedTime = time.timeSinceLoad; chk.lastActivatedTime = time.timeSinceLoad;
for (obj in this.level.dtsObjects) { for (obj in this.level.dtsObjects) {
if (obj.identifier == "Checkpoint" && obj != chk) if (obj.identifier == "Checkpoint" && obj != chk)
@ -44,4 +47,5 @@ class CheckpointTrigger extends Trigger {
} }
} }
} }
}
} }