mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
118 lines
3.5 KiB
Haxe
118 lines
3.5 KiB
Haxe
package rewind;
|
|
|
|
import mis.MissionElement.MissionElementBase;
|
|
import triggers.CheckpointTrigger;
|
|
import src.PathedInterior.PIState;
|
|
import shapes.PowerUp;
|
|
import h3d.Vector;
|
|
import h3d.Quat;
|
|
import src.TimeState;
|
|
import src.DtsObject;
|
|
import shapes.Gem;
|
|
|
|
@:publicFields
|
|
class RewindFrame {
|
|
var timeState:TimeState;
|
|
var marblePosition:Vector;
|
|
var marbleOrientation:Quat;
|
|
var marbleVelocity:Vector;
|
|
var marbleAngularVelocity:Vector;
|
|
var marblePowerup:PowerUp;
|
|
var bonusTime:Float;
|
|
var mpStates:Array<{
|
|
curState:PIState,
|
|
prevState:PIState,
|
|
stopped:Bool,
|
|
stopTime:Float
|
|
}>;
|
|
var gemCount:Int;
|
|
var gemStates:Array<Bool>;
|
|
var powerupStates:Array<Float>;
|
|
var landMineStates:Array<Float>;
|
|
var activePowerupStates:Array<Float>;
|
|
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<Gem, Bool>,
|
|
checkpointHeldPowerup:PowerUp,
|
|
checkpointUp:Vector,
|
|
checkpointBlast:Float
|
|
};
|
|
|
|
public function new() {}
|
|
|
|
public function clone() {
|
|
var c = new RewindFrame();
|
|
c.timeState = timeState.clone();
|
|
c.marblePosition = marblePosition.clone();
|
|
c.marbleOrientation = marbleOrientation.clone();
|
|
c.marbleVelocity = marbleVelocity.clone();
|
|
c.marbleAngularVelocity = marbleAngularVelocity.clone();
|
|
c.marblePowerup = marblePowerup;
|
|
c.bonusTime = bonusTime;
|
|
c.gemCount = gemCount;
|
|
c.gemStates = gemStates.copy();
|
|
c.powerupStates = powerupStates.copy();
|
|
c.landMineStates = landMineStates.copy();
|
|
c.activePowerupStates = activePowerupStates.copy();
|
|
c.currentUp = currentUp.clone();
|
|
c.lastContactNormal = lastContactNormal.clone();
|
|
c.mpStates = [];
|
|
for (s in mpStates) {
|
|
c.mpStates.push({
|
|
curState: {
|
|
currentTime: s.curState.currentTime,
|
|
targetTime: s.curState.targetTime,
|
|
velocity: s.curState.velocity.clone(),
|
|
currentPosition: s.curState.currentPosition.clone(),
|
|
prevPosition: s.curState.prevPosition.clone(),
|
|
changeTime: s.curState.changeTime,
|
|
},
|
|
stopTime: s.stopTime,
|
|
stopped: s.stopped,
|
|
prevState: s.prevState != null ? {
|
|
currentTime: s.prevState.currentTime,
|
|
targetTime: s.prevState.targetTime,
|
|
velocity: s.prevState.velocity.clone(),
|
|
currentPosition: s.prevState.currentPosition.clone(),
|
|
prevPosition: s.prevState.prevPosition.clone(),
|
|
changeTime: s.prevState.changeTime,
|
|
} : null,
|
|
});
|
|
}
|
|
c.trapdoorStates = [];
|
|
for (s in trapdoorStates) {
|
|
c.trapdoorStates.push({
|
|
lastContactTime: s.lastContactTime,
|
|
lastDirection: s.lastDirection,
|
|
lastCompletion: s.lastCompletion,
|
|
});
|
|
}
|
|
c.blastAmt = blastAmt;
|
|
c.oobState = {
|
|
oob: oobState.oob,
|
|
timeState: oobState.timeState != null ? oobState.timeState.clone() : null
|
|
};
|
|
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,
|
|
};
|
|
return c;
|
|
}
|
|
}
|