public TtcRotatingBlock(TtcRng rng, uint address) : this( rng : rng, timerMax : Config.Stream.GetInt(address + 0xFC), timer : Config.Stream.GetInt(address + 0x154)) { }
public TtcSpinner(TtcRng rng, int angle, int direction, int timerMax, int timer) : base(rng) { _angle = angle; _direction = direction; _timerMax = timerMax; _timer = timer; }
public TtcSpinningTriangle(TtcRng rng, int angle, int currentAngularVelocity, int targetAngularVelocity) : base(rng) { _angle = angle; _currentAngularVelocity = currentAngularVelocity; _targetAngularVelocity = targetAngularVelocity; }
public TtcBobomb(TtcRng rng, uint address) : this( rng : rng, blinkingTimer : Config.Stream.GetInt32(address + 0xF4), withinMarioRange : PositionAngle.GetDistance(PositionAngle.Obj(address), PositionAngle.Mario) < 4000 ? 1 : 0) { }
public TtcRotatingTriangularPrism(TtcRng rng, uint address) : this( rng : rng, timerMax : Config.Stream.GetInt32(address + 0xFC), timer : Config.Stream.GetInt32(address + 0x154)) { }
public TtcPusher(TtcRng rng, int timerMax, int countdown, int state, int timer) : base(rng) { _timerMax = timerMax; _countdown = countdown; _state = state; _timer = timer; }
public TtcAmp(TtcRng rng, uint address) : this( rng : rng, state : Config.Stream.GetInt(address + 0x14C), angle : Normalize(Config.Stream.GetInt(address + 0xC8))) { }
public TtcSpinningTriangle(TtcRng rng, uint address) : this( rng : rng, angle : Normalize(Config.Stream.GetInt32(address + 0xD4)), currentAngularVelocity : (int)Config.Stream.GetSingle(address + 0xF8), targetAngularVelocity : (int)Config.Stream.GetSingle(address + 0xFC)) { }
public TtcSimulation(ushort rngValue, int startingFrame, List <int> dustFrames = null) { //set up objects _rng = new TtcRng(rngValue); //initial RNG during star selection screen _rngObjects = TtcUtilities.CreateRngObjects(_rng, dustFrames); //set up testing variables _startingFrame = startingFrame; //the frame directly preceding any object initialization }
public TtcPitBlock(TtcRng rng, int height, int verticalSpeed, int direction, int timerMax, int timer) : base(rng) { _height = height; _verticalSpeed = verticalSpeed; _direction = direction; _timerMax = timerMax; _timer = timer; }
public TtcPusher(TtcRng rng, uint address) : this( rng : rng, timerMax : Config.Stream.GetInt32(address + 0xF4), countdown : Config.Stream.GetInt32(address + 0xF8), state : Config.Stream.GetInt32(address + 0x14C), timer : Config.Stream.GetInt32(address + 0x154)) { }
public TtcSimulation(List <int> dustFrames = null) { //set up objects _rng = new TtcRng(Config.Stream.GetUInt16(MiscConfig.RngAddress)); _rngObjects = TtcUtilities.CreateRngObjectsFromGame(_rng, dustFrames); //set up testing variables _startingFrame = MupenUtilities.GetFrameCount(); //the frame directly preceding any object initialization }
public TtcSpinner(TtcRng rng, uint address) : this( rng : rng, angle : Normalize(Config.Stream.GetInt(address + 0xD0)), direction : Config.Stream.GetInt(address + 0xF4), timerMax : Config.Stream.GetInt(address + 0xF8), timer : Config.Stream.GetInt(address + 0x154)) { }
public TtcPendulum(TtcRng rng, float accelerationDirection, float angle, float angularVelocity, float accelerationMagnitude, int waitingTimer) : base(rng) { _accelerationDirection = accelerationDirection; _angle = angle; _angularVelocity = angularVelocity; _accelerationMagnitude = accelerationMagnitude; _waitingTimer = waitingTimer; }
public TtcTreadmill(TtcRng rng, int subType, int currentSpeed, int targetSpeed, int timerMax, int timer) : base(rng) { _subType = subType; _currentSpeed = currentSpeed; _targetSpeed = targetSpeed; _timerMax = timerMax; _timer = timer; }
public TtcThwomp(TtcRng rng, int height, int verticalSpeed, int timerMax, int state, int timer) : base(rng) { _height = height; _verticalSpeed = verticalSpeed; _timerMax = timerMax; _state = state; _timer = timer; }
public TtcTreadmill(TtcRng rng, uint address) : this( rng : rng, subType : Config.Stream.GetInt32(address + 0x144), currentSpeed : (int)Config.Stream.GetSingle(address + 0xFC), targetSpeed : (int)Config.Stream.GetSingle(address + 0x100), timerMax : Config.Stream.GetInt32(address + 0x104), timer : Config.Stream.GetInt32(address + 0x154)) { }
public TtcPendulum(TtcRng rng, uint address) : this( rng : rng, accelerationDirection : Config.Stream.GetFloat(address + 0xF4), angle : Config.Stream.GetFloat(address + 0xF8), angularVelocity : Config.Stream.GetFloat(address + 0xFC), accelerationMagnitude : Config.Stream.GetFloat(address + 0x100), waitingTimer : Config.Stream.GetInt(address + 0x104)) { }
public TtcHand(TtcRng rng, int angle, int timerMax, int targetAngle, int displacement, int directionCountdown, int timer) : base(rng) { _angle = angle; _timerMax = timerMax; _targetAngle = targetAngle; _displacement = displacement; _directionCountdown = directionCountdown; _timer = timer; }
public TtcPitBlock(TtcRng rng, uint address) : this( rng : rng, height : (int)Config.Stream.GetFloat(address + 0xA4), verticalSpeed : (int)Config.Stream.GetFloat(address + 0xB0), direction : Config.Stream.GetInt(address + 0xF8), timerMax : Config.Stream.GetInt(address + 0xFC), timer : Config.Stream.GetInt(address + 0x154)) { }
public TtcThwomp(TtcRng rng, uint address) : this( rng : rng, height : (int)Config.Stream.GetSingle(address + 0xA4), verticalSpeed : (int)Config.Stream.GetSingle(address + 0xB0), timerMax : Config.Stream.GetInt32(address + 0xF4), state : Config.Stream.GetInt32(address + 0x14C), timer : Config.Stream.GetInt32(address + 0x154)) { }
public TtcHand(TtcRng rng, uint address) : this( rng : rng, angle : Normalize(Config.Stream.GetInt(address + 0xD4)), timerMax : Config.Stream.GetInt(address + 0xF4), targetAngle : Normalize(Config.Stream.GetInt(address + 0xF8)), displacement : Config.Stream.GetInt(address + 0xFC), directionCountdown : Config.Stream.GetInt(address + 0x104), timer : Config.Stream.GetInt(address + 0x154)) { }
public TtcElevator(TtcRng rng, uint address) : this( rng : rng, minHeight : (int)Config.Stream.GetFloat(address + 0x168), maxHeight : (int)Config.Stream.GetFloat(address + 0xF8), height : (int)Config.Stream.GetFloat(address + 0xA4), verticalSpeed : (int)Config.Stream.GetFloat(address + 0xB0), direction : (int)Config.Stream.GetFloat(address + 0xF4), timerMax : Config.Stream.GetInt(address + 0xFC), timer : Config.Stream.GetInt(address + 0x154)) { }
public TtcElevator( TtcRng rng, int minHeight, int maxHeight, int height, int verticalSpeed, int direction, int timerMax, int timer) : base(rng) { MIN_HEIGHT = minHeight; MAX_HEIGHT = maxHeight; _height = height; _verticalSpeed = verticalSpeed; _direction = direction; _timerMax = timerMax; _timer = timer; }
public static (TtcRng, List <TtcObject>) CreateRngObjectsFromSaveState(TtcSaveState saveState) { TtcSaveStateByteIterator iter = saveState.GetIterator(); TtcRng rng = new TtcRng(iter.GetUShort()); List <TtcObject> rngObjects = new List <TtcObject>(); for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcRotatingBlock(rng, iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcRotatingTriangularPrism(rng, iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 4; i++) { rngObjects.Add(new TtcPendulum(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcTreadmill(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 12; i++) { rngObjects.Add(new TtcPusher(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcCog(rng, iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcSpinningTriangle(rng, iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcPitBlock(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcHand(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 14; i++) { rngObjects.Add(new TtcSpinner(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcWheel(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { if (i == 0) { rngObjects.Add(new TtcElevator(rng, 445, 1045, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcElevator(rng, -1454, -1254, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcCog(rng, iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 6)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcTreadmill(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 6)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcThwomp(rng, iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcAmp(rng, iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcBobomb(rng, iter.GetInt(), iter.GetInt()).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { TtcDust dust = new TtcDust(rng).SetIndex(i + 1) as TtcDust; // if (dustFrames != null) dust.AddDustFrames(dustFrames); rngObjects.Add(dust); } if (!iter.IsDone()) { throw new ArgumentOutOfRangeException(); } return(rng, rngObjects); }
public static List <TtcObject> CreateRngObjectsFromGame(TtcRng rng, List <int> dustFrames = null) { Func <int, uint> getOffset = (int i) => (uint)i * 0x260; List <TtcObject> rngObjects = new List <TtcObject>(); for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcRotatingBlock(rng, TtcObjectConfig.TtcRotatingBlockAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcRotatingTriangularPrism(rng, TtcObjectConfig.TtcRotatingTriangularPrismAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 4; i++) { rngObjects.Add(new TtcPendulum(rng, TtcObjectConfig.TtcPendulumAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcTreadmill(rng, TtcObjectConfig.TtcTreadmill1Address + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 12; i++) { rngObjects.Add(new TtcPusher(rng, TtcObjectConfig.TtcPusherAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcCog(rng, TtcObjectConfig.TtcCog1Address + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcSpinningTriangle(rng, TtcObjectConfig.TtcSpinningTriangleAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcPitBlock(rng, TtcObjectConfig.TtcPitBlockAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcHand(rng, TtcObjectConfig.TtcHandAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 14; i++) { rngObjects.Add(new TtcSpinner(rng, TtcObjectConfig.TtcSpinnerAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcWheel(rng, TtcObjectConfig.TtcWheelAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcElevator(rng, TtcObjectConfig.TtcElevatorAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcCog(rng, TtcObjectConfig.TtcCog2Address + getOffset(i)).SetIndex(i + 6)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcTreadmill(rng, TtcObjectConfig.TtcTreadmill2Address + getOffset(i)).SetIndex(i + 6)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcThwomp(rng, TtcObjectConfig.TtcThwompAddress + getOffset(i)).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { if (i == 0) { rngObjects.Add(new TtcAmp(rng, TtcObjectConfig.TtcAmp1Address).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcAmp(rng, TtcObjectConfig.TtcAmp2Address).SetIndex(i + 1)); } } List <ObjectDataModel> bobombs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bob-omb"); bobombs.Sort((obj1, obj2) => { string label1 = Config.ObjectSlotsManager.GetSlotLabelFromObject(obj1); string label2 = Config.ObjectSlotsManager.GetSlotLabelFromObject(obj2); int pos1 = ParsingUtilities.ParseInt(label1); int pos2 = ParsingUtilities.ParseInt(label2); return(pos1 - pos2); }); for (int i = 0; i < bobombs.Count; i++) { rngObjects.Add(new TtcBobomb(rng, bobombs[i].Address).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { TtcDust dust = new TtcDust(rng).SetIndex(i + 1) as TtcDust; if (dustFrames != null) { dust.AddDustFrames(dustFrames); } rngObjects.Add(dust); } return(rngObjects); }
public static List <TtcObject> CreateRngObjects(TtcRng rng, List <int> dustFrames = null) { List <TtcObject> rngObjects = new List <TtcObject>(); for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcRotatingBlock(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcRotatingTriangularPrism(rng).SetIndex(i + 1)); } for (int i = 0; i < 4; i++) { rngObjects.Add(new TtcPendulum(rng).SetIndex(i + 1)); } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcTreadmill(rng, i == 0 ? 0 : 1).SetIndex(i + 1)); } for (int i = 0; i < 12; i++) { if (i == 0) { rngObjects.Add(new TtcPusher(rng, 20).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcPusher(rng, 0).SetIndex(i + 1)); } if (i == 2) { rngObjects.Add(new TtcPusher(rng, 50).SetIndex(i + 1)); } if (i == 3) { rngObjects.Add(new TtcPusher(rng, 100).SetIndex(i + 1)); } if (i == 4) { rngObjects.Add(new TtcPusher(rng, 0).SetIndex(i + 1)); } if (i == 5) { rngObjects.Add(new TtcPusher(rng, 10).SetIndex(i + 1)); } if (i == 6) { rngObjects.Add(new TtcPusher(rng, 0).SetIndex(i + 1)); } if (i == 7) { rngObjects.Add(new TtcPusher(rng, 0).SetIndex(i + 1)); } if (i == 8) { rngObjects.Add(new TtcPusher(rng, 0).SetIndex(i + 1)); } if (i == 9) { rngObjects.Add(new TtcPusher(rng, 30).SetIndex(i + 1)); } if (i == 10) { rngObjects.Add(new TtcPusher(rng, 10).SetIndex(i + 1)); } if (i == 11) { rngObjects.Add(new TtcPusher(rng, 20).SetIndex(i + 1)); } } for (int i = 0; i < 5; i++) { rngObjects.Add(new TtcCog(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { if (i == 0) { rngObjects.Add(new TtcSpinningTriangle(rng, 40960).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcSpinningTriangle(rng, 57344).SetIndex(i + 1)); } } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcPitBlock(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { if (i == 0) { rngObjects.Add(new TtcHand(rng, 40960).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcHand(rng, 8192).SetIndex(i + 1)); } } for (int i = 0; i < 14; i++) { rngObjects.Add(new TtcSpinner(rng).SetIndex(i + 1)); } for (int i = 0; i < 6; i++) { rngObjects.Add(new TtcWheel(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { if (i == 0) { rngObjects.Add(new TtcElevator(rng, 445, 1045).SetIndex(i + 1)); } if (i == 1) { rngObjects.Add(new TtcElevator(rng, -1454, -1254).SetIndex(i + 1)); } } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcCog(rng).SetIndex(i + 6)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcTreadmill(rng, i + 2).SetIndex(i + 6)); } for (int i = 0; i < 1; i++) { rngObjects.Add(new TtcThwomp(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcAmp(rng).SetIndex(i + 1)); } for (int i = 0; i < 2; i++) { rngObjects.Add(new TtcBobomb(rng).SetIndex(i + 1)); } for (int i = 0; i < 1; i++) { TtcDust dust = new TtcDust(rng).SetIndex(i + 1) as TtcDust; if (dustFrames != null) { dust.AddDustFrames(dustFrames); } rngObjects.Add(dust); } return(rngObjects); }
/** id begins as the object's class name by default. */ public TtcObject(TtcRng rng) { _rng = rng; _id = GetType().Name.ToString(); }
public abstract TtcObject Clone(TtcRng rng);
public TtcRotatingTriangularPrism(TtcRng rng, int timerMax, int timer) : base(rng) { _timerMax = timerMax; _timer = timer; }