コード例 #1
0
        protected override List <(float x, float y, float z)> GetVerticesTopDownView()
        {
            PositionAngle posAngle = GetPositionAngle();
            float         x        = (float)posAngle.X;
            float         y        = (float)posAngle.Y;
            float         z        = (float)posAngle.Z;
            float         yaw      = (float)GetYaw();
            float         size     = _useRecommendedArrowLength ? (float)GetRecommendedSize() : Size;

            (float arrowHeadX, float arrowHeadZ) =
                ((float, float))MoreMath.AddVectorToPoint(size, yaw, x, z);

            (float pointSide1X, float pointSide1Z) =
                ((float, float))MoreMath.AddVectorToPoint(_arrowHeadSideLength, yaw + 32768 + 8192, arrowHeadX, arrowHeadZ);
            (float pointSide2X, float pointSide2Z) =
                ((float, float))MoreMath.AddVectorToPoint(_arrowHeadSideLength, yaw + 32768 - 8192, arrowHeadX, arrowHeadZ);

            List <(float x, float y, float z)> vertices = new List <(float x, float y, float z)>();

            vertices.Add((x, y, z));
            vertices.Add((arrowHeadX, y, arrowHeadZ));

            vertices.Add((arrowHeadX, y, arrowHeadZ));
            vertices.Add((pointSide1X, y, pointSide1Z));

            vertices.Add((arrowHeadX, y, arrowHeadZ));
            vertices.Add((pointSide2X, y, pointSide2Z));

            return(vertices);
        }
コード例 #2
0
        public override MapObjectHoverData GetHoverDataOrthographicView(bool isForObjectDrag, bool forceCursorPosition)
        {
            if (_customImage == null)
            {
                return(null);
            }

            Point?relPosMaybe = MapObjectHoverData.GetPositionMaybe(isForObjectDrag, forceCursorPosition);

            if (!relPosMaybe.HasValue)
            {
                return(null);
            }
            Point relPos = relPosMaybe.Value;

            (double x, double y, double z)   = PositionAngle.GetMidPoint(_posAngle1, _posAngle2);
            (float controlX, float controlZ) = MapUtilities.ConvertCoordsForControlOrthographicView((float)x, (float)y, (float)z, UseRelativeCoordinates);
            double dist   = MoreMath.GetDistanceBetween(controlX, controlZ, relPos.X, relPos.Y);
            double radius = Scales ? _iconSize * Config.CurrentMapGraphics.MapViewScaleValue : _iconSize;

            if (dist <= radius || forceCursorPosition)
            {
                return(new MapObjectHoverData(this, x, y, z));
            }
            return(null);
        }
コード例 #3
0
        public static MapCustomPositionAngleObject Create()
        {
            string        text     = DialogUtilities.GetStringFromDialog(labelText: "Enter a PositionAngle.");
            PositionAngle posAngle = PositionAngle.FromString(text);

            return(posAngle != null ? new MapCustomPositionAngleObject(posAngle) : null);
        }
コード例 #4
0
        public MapCustomSphereObject(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Size = 1000;
        }
コード例 #5
0
        public override MapObjectHoverData GetHoverDataTopDownView(bool isForObjectDrag, bool forceCursorPosition)
        {
            if (_customImage == null)
            {
                return(null);
            }

            Point?relPosMaybe = MapObjectHoverData.GetPositionMaybe(isForObjectDrag, forceCursorPosition);

            if (!relPosMaybe.HasValue)
            {
                return(null);
            }
            Point relPos = relPosMaybe.Value;

            (float inGameX, float inGameZ) = MapUtilities.ConvertCoordsForInGameTopDownView(relPos.X, relPos.Y);

            (double x, double y, double z) = PositionAngle.GetMidPoint(_posAngle1, _posAngle2);
            double dist   = MoreMath.GetDistanceBetween(x, z, inGameX, inGameZ);
            double radius = Scales ? _iconSize : _iconSize / Config.CurrentMapGraphics.MapViewScaleValue;

            if (dist <= radius || forceCursorPosition)
            {
                return(new MapObjectHoverData(this, x, y, z));
            }
            return(null);
        }
コード例 #6
0
 public MapObjectObjectCeiling(PositionAngle posAngle)
     : base()
 {
     _posAngle   = posAngle;
     _autoUpdate = true;
     _tris       = new List <TriangleDataModel>();
 }
コード例 #7
0
ファイル: TTCBobomb.cs プロジェクト: chaosBrick/STROOP
 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)
 {
 }
コード例 #8
0
ファイル: MapObjectArrow.cs プロジェクト: SM64-TAS-ABC/STROOP
        public override void SetDragPositionTopDownView(double?x = null, double?y = null, double?z = null)
        {
            if (!x.HasValue || !z.HasValue)
            {
                return;
            }

            PositionAngle posAngle = GetPositionAngle();
            double        dist     = MoreMath.GetDistanceBetween(posAngle.X, posAngle.Z, x.Value, z.Value);
            double        angle    = MoreMath.AngleTo_AngleUnits(posAngle.X, posAngle.Z, x.Value, z.Value);

            if (!KeyboardUtilities.IsCtrlHeld())
            {
                if (_useRecommendedArrowLength)
                {
                    SetRecommendedSize(dist);
                }
                else
                {
                    GetParentMapTracker().SetSize((float)(Scales ? dist : dist *Config.CurrentMapGraphics.MapViewScaleValue));
                }
            }
            if (!KeyboardUtilities.IsShiftHeld())
            {
                SetYaw(angle);
            }
        }
コード例 #9
0
 public MapCustomPositionAngleObject(PositionAngle posAngle)
     : base()
 {
     _posAngle             = posAngle;
     positionAngleProvider = () => new[] { _posAngle };
     InternalRotates       = true;
 }
コード例 #10
0
        public MapEffectiveHurtboxCylinderObject(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Color = Color.Purple;
        }
コード例 #11
0
        public override void SetDragPositionTopDownView(double?x = null, double?y = null, double?z = null)
        {
            if (!x.HasValue || !z.HasValue)
            {
                return;
            }

            PositionAngle posAngle = _posAngle.GetBasePositionAngle();
            double        dist     = MoreMath.GetDistanceBetween(posAngle.X, posAngle.Z, x.Value, z.Value);
            double        angle    = MoreMath.AngleTo_AngleUnits(posAngle.X, posAngle.Z, x.Value, z.Value);

            if (Rotates)
            {
                angle -= posAngle.Angle;
            }

            if (!KeyboardUtilities.IsCtrlHeld())
            {
                _posAngle.SetOffsetDist(dist);
            }
            if (!KeyboardUtilities.IsShiftHeld())
            {
                _posAngle.SetOffsetAngle(angle);
            }

            MapTracker mapTracker = GetParentMapTracker();

            mapTracker.SetSize((float)_posAngle.GetOffsetDist());
            mapTracker.SetLineWidth((float)_posAngle.GetOffsetAngle());
        }
コード例 #12
0
        public MapObjectCustomPositionAngle(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            InternalRotates = true;
        }
コード例 #13
0
ファイル: MapObjectArrow.cs プロジェクト: SM64-TAS-ABC/STROOP
        private (float x, float y, float z) GetArrowHeadPosition()
        {
            PositionAngle posAngle = GetPositionAngle();
            float         x        = (float)posAngle.X;
            float         y        = (float)posAngle.Y;
            float         z        = (float)posAngle.Z;
            float         preYaw   = (float)GetYaw() + _angleOffset;
            float         yaw      = _useTruncatedAngle ? MoreMath.NormalizeAngleTruncated(preYaw) : preYaw;
            float         pitch    = _usePitch ? (float)GetPitch() : 0;
            float         size     = _useRecommendedArrowLength ? (float)GetRecommendedSize() : Size;

            if (!Scales)
            {
                size /= Config.CurrentMapGraphics.MapViewScaleValue;
            }

            float arrowHeadX;
            float arrowHeadY;
            float arrowHeadZ;

            if (_usePitch)
            {
                (arrowHeadX, arrowHeadY, arrowHeadZ) = ((float, float, float))
                                                       MoreMath.AddVectorToPointWithPitch(size, yaw, pitch, x, y, z, false);
            }
            else
            {
                (arrowHeadX, arrowHeadZ) = ((float, float))
                                           MoreMath.AddVectorToPoint(size, yaw, x, z);
                arrowHeadY = y;
            }

            return(arrowHeadX, arrowHeadY, arrowHeadZ);
        }
コード例 #14
0
        public MapObjectCustomCylinder(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Size = 1000;
        }
コード例 #15
0
        public MapObjectPushHitboxCylinder(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Color = Color.Orange;
        }
コード例 #16
0
 public MapObjectObjectCustomArrow(PositionAngle posAngle, uint yawOffset, int numBytes)
     : base()
 {
     _posAngle  = posAngle;
     _yawOffset = yawOffset;
     _numBytes  = numBytes;
 }
コード例 #17
0
        public MapObjectCoffinBox(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            LineWidth = 3;
            LineColor = Color.Magenta;
        }
コード例 #18
0
        public MapObjectEffectiveHurtboxCylinder(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;
            _useInteractionStatusAsColor = false;

            Color = Color.Purple;
        }
コード例 #19
0
        public MapCurrentUnitObject(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Opacity = 0.5;
            Color   = Color.Purple;
        }
コード例 #20
0
 public MapObjectCustomArrowObject(PositionAngle posAngle, uint yawOffset, int numBytes)
     : base()
 {
     _posAngle   = posAngle;
     _objAddress = posAngle.GetObjAddress();
     _yawOffset  = yawOffset;
     _numBytes   = numBytes;
 }
コード例 #21
0
        public MapObjectCurrentCell(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Opacity = 0.5;
            Color   = Color.Yellow;
        }
コード例 #22
0
        public MapFacingDividerObject(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Size         = 1000;
            OutlineWidth = 3;
            OutlineColor = Color.Red;
        }
コード例 #23
0
        public MapObjectOffsetPositionAngle(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;
            _iconSize = 25;

            Size      = 100;
            LineWidth = 0;
        }
コード例 #24
0
        public MapHomeLineObject(uint objAddress)
            : base()
        {
            _objPosAngle  = PositionAngle.Obj(objAddress);
            _homePosAngle = PositionAngle.ObjHome(objAddress);

            OutlineWidth = 3;
            OutlineColor = Color.Black;
        }
コード例 #25
0
        public MapObjectFacingDivider(PositionAngle posAngle)
            : base()
        {
            _posAngle = posAngle;

            Size      = 1000;
            LineWidth = 3;
            LineColor = Color.Red;
        }
コード例 #26
0
        public MapObjectHomeLine(PositionAngle posAngle)
            : base()
        {
            _objPosAngle  = PositionAngle.Obj(posAngle.GetObjAddress());
            _homePosAngle = PositionAngle.ObjHome(posAngle.GetObjAddress());

            LineWidth = 3;
            LineColor = Color.Black;
        }
コード例 #27
0
ファイル: MapSectorObject.cs プロジェクト: Madghostek/STROOP
        public MapSectorObject(PositionAngle posAngle)
            : base()
        {
            _posAngle    = posAngle;
            _angleRadius = 4096;

            Size    = 1000;
            Opacity = 0.5;
            Color   = Color.Yellow;
        }
コード例 #28
0
        public override List <ToolStripItem> GetHoverContextMenuStripItems(MapObjectHoverData hoverData)
        {
            List <ToolStripItem> output = base.GetHoverContextMenuStripItems(hoverData);

            (double x, double y, double z) = PositionAngle.GetMidPoint(_posAngle1, _posAngle2);
            ToolStripMenuItem copyPositionItem = MapUtilities.CreateCopyItem(x, y, z, "Position");

            output.Insert(0, copyPositionItem);

            return(output);
        }
コード例 #29
0
        public static MapObject Create(string text1, string text2)
        {
            PositionAngle posAngle1 = PositionAngle.FromString(text1);
            PositionAngle posAngle2 = PositionAngle.FromString(text2);

            if (posAngle1 == null || posAngle2 == null)
            {
                return(null);
            }
            return(new MapLineSegmentObject(posAngle1, posAngle2));
        }
コード例 #30
0
        public MapLineSegmentObject(PositionAngle posAngle1, PositionAngle posAngle2)
            : base()
        {
            _posAngle1     = posAngle1;
            _posAngle2     = posAngle2;
            _useFixedSize  = false;
            _backwardsSize = 0;

            Size         = 0;
            OutlineWidth = 3;
            OutlineColor = Color.Red;
        }