Exemplo n.º 1
0
 public TtcRotatingBlock(TtcRng rng, uint address) :
     this(
         rng : rng,
         timerMax : Config.Stream.GetInt(address + 0xFC),
         timer : Config.Stream.GetInt(address + 0x154))
 {
 }
Exemplo n.º 2
0
 public TtcSpinner(TtcRng rng, int angle, int direction, int timerMax, int timer) : base(rng)
 {
     _angle     = angle;
     _direction = direction;
     _timerMax  = timerMax;
     _timer     = timer;
 }
Exemplo n.º 3
0
 public TtcSpinningTriangle(TtcRng rng, int angle,
                            int currentAngularVelocity, int targetAngularVelocity) : base(rng)
 {
     _angle = angle;
     _currentAngularVelocity = currentAngularVelocity;
     _targetAngularVelocity  = targetAngularVelocity;
 }
Exemplo n.º 4
0
 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))
 {
 }
Exemplo n.º 6
0
 public TtcPusher(TtcRng rng, int timerMax, int countdown, int state, int timer) : base(rng)
 {
     _timerMax  = timerMax;
     _countdown = countdown;
     _state     = state;
     _timer     = timer;
 }
Exemplo n.º 7
0
 public TtcAmp(TtcRng rng, uint address) :
     this(
         rng : rng,
         state : Config.Stream.GetInt(address + 0x14C),
         angle : Normalize(Config.Stream.GetInt(address + 0xC8)))
 {
 }
Exemplo n.º 8
0
 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))
 {
 }
Exemplo n.º 9
0
        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
        }
Exemplo n.º 10
0
 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;
 }
Exemplo n.º 11
0
 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))
 {
 }
Exemplo n.º 12
0
        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
        }
Exemplo n.º 13
0
 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))
 {
 }
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
 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;
 }
Exemplo n.º 16
0
 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;
 }
Exemplo n.º 17
0
 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))
 {
 }
Exemplo n.º 18
0
 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))
 {
 }
Exemplo n.º 19
0
 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;
 }
Exemplo n.º 20
0
 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))
 {
 }
Exemplo n.º 21
0
 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))
 {
 }
Exemplo n.º 22
0
 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))
 {
 }
Exemplo n.º 23
0
 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))
 {
 }
Exemplo n.º 24
0
 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;
 }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
        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);
        }
Exemplo n.º 28
0
 /** id begins as the object's class name by default.
  */
 public TtcObject(TtcRng rng)
 {
     _rng = rng;
     _id  = GetType().Name.ToString();
 }
Exemplo n.º 29
0
 public abstract TtcObject Clone(TtcRng rng);
 public TtcRotatingTriangularPrism(TtcRng rng, int timerMax, int timer) : base(rng)
 {
     _timerMax = timerMax;
     _timer    = timer;
 }