diff --git a/src/Replay.hx b/src/Replay.hx index 2d0f0b5f..07fccbc0 100644 --- a/src/Replay.hx +++ b/src/Replay.hx @@ -344,14 +344,6 @@ class Replay { curframe = this.frames[this.frames.length - 1]; } } - if (this.initialState.randomGenTimes.length > 0) { - var rtimeIdx = this.initialState.randomGenTimes.length - 1; - while (this.initialState.randomGenTimes[rtimeIdx] > cutAfterTime && this.initialState.randomGenTimes.length > 0) { - this.initialState.randomGenTimes.pop(); - this.initialState.randomGens.pop(); - rtimeIdx = this.initialState.randomGenTimes.length - 1; - } - } } public function write() { diff --git a/src/Settings.hx b/src/Settings.hx index 22043847..2cf2e45a 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -268,12 +268,14 @@ class Settings { if (gamepadSettings.rewind == null) { gamepadSettings.rewind = ["Y"]; } + #if js if (controlsSettings.rewind == null) { controlsSettings.rewind = Key.R; } if (optionsSettings.rewindEnabled == null) { optionsSettings.rewindEnabled = false; } + #end progression = json.progression; highscoreName = json.highscoreName; } else { diff --git a/src/rewind/RewindFrame.hx b/src/rewind/RewindFrame.hx index 9edf4215..56ba1f19 100644 --- a/src/rewind/RewindFrame.hx +++ b/src/rewind/RewindFrame.hx @@ -1,7 +1,6 @@ package rewind; import mis.MissionElement.MissionElementBase; -import triggers.CheckpointTrigger; import src.PathedInterior.PIState; import shapes.PowerUp; import h3d.Vector; @@ -33,21 +32,11 @@ class RewindFrame { var currentUp:Vector; var trapdoorStates:Array<{lastContactTime:Float, lastDirection:Int, lastCompletion:Float}>; var lastContactNormal:Vector; - var blastAmt:Float; var oobState:{ oob:Bool, timeState:TimeState }; - var checkpointState:{ - currentCheckpoint:{obj:DtsObject, elem:MissionElementBase}, - currentCheckpointTrigger:CheckpointTrigger, - checkpointCollectedGems:Map, - checkpointHeldPowerup:PowerUp, - checkpointUp:Vector, - checkpointBlast:Float - }; - public function new() {} public function clone() { @@ -97,21 +86,9 @@ class RewindFrame { lastCompletion: s.lastCompletion, }); } - c.blastAmt = blastAmt; c.oobState = { oob: oobState.oob, timeState: oobState.timeState.clone() }; - c.checkpointState = { - currentCheckpoint: checkpointState.currentCheckpoint != null ? { - obj: checkpointState.currentCheckpoint.obj, - elem: checkpointState.currentCheckpoint.elem, - } : null, - currentCheckpointTrigger: checkpointState.currentCheckpointTrigger, - checkpointCollectedGems: checkpointState.checkpointCollectedGems.copy(), - checkpointHeldPowerup: checkpointState.checkpointHeldPowerup, - checkpointUp: checkpointState.checkpointUp != null ? checkpointState.checkpointUp.clone() : null, - checkpointBlast: checkpointState.checkpointBlast, - }; } } diff --git a/src/rewind/RewindManager.hx b/src/rewind/RewindManager.hx index 14d5663d..ad798864 100644 --- a/src/rewind/RewindManager.hx +++ b/src/rewind/RewindManager.hx @@ -7,7 +7,6 @@ import src.MarbleWorld; import shapes.Trapdoor; import shapes.PushButton; import src.Util; -import shapes.Nuke; class RewindManager { var frames:Array = []; @@ -29,12 +28,11 @@ class RewindManager { rf.marblePowerup = level.marble.heldPowerup; rf.bonusTime = level.bonusTime; rf.gemCount = level.gemCount; - rf.gemStates = level.gems.map(x -> x.pickedUp); + rf.gemStates = level.dtsObjects.filter(x -> x is shapes.Gem).map(x -> cast(x, shapes.Gem).pickedUp); rf.activePowerupStates = [@:privateAccess level.marble.superBounceEnableTime, @:privateAccess level.marble.shockAbsorberEnableTime, @:privateAccess - level.marble.helicopterEnableTime, @:privateAccess - level.marble.megaMarbleEnableTime + level.marble.helicopterEnableTime, ]; rf.currentUp = level.currentUp.clone(); rf.lastContactNormal = level.marble.lastContactNormal.clone(); @@ -76,10 +74,6 @@ class RewindManager { var lm:LandMine = cast dts; rf.landMineStates.push(lm.disappearTime); } - if (dts is Nuke) { - var lm:Nuke = cast dts; - rf.landMineStates.push(lm.disappearTime); - } if (dts is Trapdoor) { var td:Trapdoor = cast dts; rf.trapdoorStates.push({ @@ -93,19 +87,10 @@ class RewindManager { rf.powerupStates.push(ab.lastContactTime); } } - rf.blastAmt = level.blastAmount; rf.oobState = { oob: level.outOfBounds, timeState: level.outOfBoundsTime != null ? level.outOfBoundsTime.clone() : null }; - rf.checkpointState = { - currentCheckpoint: @:privateAccess level.currentCheckpoint, - currentCheckpointTrigger: @:privateAccess level.currentCheckpointTrigger, - checkpointBlast: @:privateAccess level.cheeckpointBlast, - checkpointCollectedGems: @:privateAccess level.checkpointCollectedGems.copy(), - checkpointHeldPowerup: @:privateAccess level.checkpointHeldPowerup, - checkpointUp: @:privateAccess level.checkpointUp != null ? @:privateAccess level.checkpointUp.clone() : null, - }; frames.push(rf); } @@ -131,13 +116,13 @@ class RewindManager { level.bonusTime = rf.bonusTime; level.gemCount = rf.gemCount; @:privateAccess level.playGui.formatGemCounter(level.gemCount, level.totalGems); + var gems = level.dtsObjects.filter(x -> x is shapes.Gem); for (i in 0...rf.gemStates.length) { - level.gems[i].setHide(rf.gemStates[i]); + gems[i].setHide(rf.gemStates[i]); } @:privateAccess level.marble.superBounceEnableTime = rf.activePowerupStates[0]; @:privateAccess level.marble.shockAbsorberEnableTime = rf.activePowerupStates[1]; @:privateAccess level.marble.helicopterEnableTime = rf.activePowerupStates[2]; - @:privateAccess level.marble.megaMarbleEnableTime = rf.activePowerupStates[3]; if (level.currentUp.x != rf.currentUp.x || level.currentUp.y != rf.currentUp.y || level.currentUp.z != rf.currentUp.z) { level.setUp(rf.currentUp, level.timeState); @@ -197,10 +182,6 @@ class RewindManager { var lm:LandMine = cast dts; lm.disappearTime = lmstates.shift(); } - if (dts is Nuke) { - var lm:Nuke = cast dts; - lm.disappearTime = lmstates.shift(); - } if (dts is Trapdoor) { var td:Trapdoor = cast dts; var tdState = tstates.shift(); @@ -224,13 +205,6 @@ class RewindManager { level.outOfBounds = rf.oobState.oob; level.marble.camera.oob = rf.oobState.oob; level.outOfBoundsTime = rf.oobState.timeState != null ? rf.oobState.timeState.clone() : null; - level.blastAmount = rf.blastAmt; - @:privateAccess level.checkpointUp = rf.checkpointState.checkpointUp; - @:privateAccess level.checkpointCollectedGems = rf.checkpointState.checkpointCollectedGems; - @:privateAccess level.cheeckpointBlast = rf.checkpointState.checkpointBlast; - @:privateAccess level.checkpointHeldPowerup = rf.checkpointState.checkpointHeldPowerup; - @:privateAccess level.currentCheckpoint = rf.checkpointState.currentCheckpoint; - @:privateAccess level.currentCheckpointTrigger = rf.checkpointState.currentCheckpointTrigger; } public function getNextRewindFrame(absTime:Float):RewindFrame {