Example #1
0
        public static void AnnihilateAllTrianglesButDeathBarriers()
        {
            bool streamAlreadySuspended = Config.Stream.IsSuspended;

            if (!streamAlreadySuspended)
            {
                Config.Stream.Suspend();
            }
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                short type = Config.Stream.GetInt16(address + TriangleOffsetsConfig.SurfaceType);
                if (type != 0x0A)
                {
                    ButtonUtilities.AnnihilateTriangle(new List <uint>()
                    {
                        address
                    });
                }
            });
            if (!streamAlreadySuspended)
            {
                Config.Stream.Resume();
            }
        }
Example #2
0
        public CameraManager(List <WatchVariable> cameraData, Control tabControl, NoTearFlowLayoutPanel variableTable)
            : base(cameraData, variableTable)
        {
            var splitContainer = tabControl.Controls["splitContainerCamera"] as SplitContainer;

            var cameraPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                cameraPosGroupBox,
                cameraPosGroupBox.Controls["buttonCameraPosXn"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosXp"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosZn"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosZp"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosXnZn"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosXnZp"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosXpZn"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosXpZp"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosYp"] as Button,
                cameraPosGroupBox.Controls["buttonCameraPosYn"] as Button,
                cameraPosGroupBox.Controls["textBoxCameraPosXZ"] as TextBox,
                cameraPosGroupBox.Controls["textBoxCameraPosY"] as TextBox,
                cameraPosGroupBox.Controls["checkBoxCameraPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCamera(
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var cameraSphericalPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraSphericalPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                cameraSphericalPosGroupBox,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTn"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTp"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosPn"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosPp"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTnPn"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTnPp"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTpPn"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosTpPp"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosRn"] as Button,
                cameraSphericalPosGroupBox.Controls["buttonCameraSphericalPosRp"] as Button,
                cameraSphericalPosGroupBox.Controls["textBoxCameraSphericalPosTP"] as TextBox,
                cameraSphericalPosGroupBox.Controls["textBoxCameraSphericalPosR"] as TextBox,
                cameraSphericalPosGroupBox.Controls["checkBoxCameraSphericalPosPivotOnFocus"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool pivotOnFocus) =>
            {
                ButtonUtilities.TranslateCameraSpherically(
                    -1 * nOffset,
                    hOffset,
                    -1 * vOffset,
                    getSphericalPivotPoint(pivotOnFocus));
            });
        }
Example #3
0
        public static void NeutralizeAllTriangles()
        {
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                ButtonUtilities.NeutralizeTriangle(address);
            });
        }
Example #4
0
        public bool TranslateMapFocusPosition(float xOffset, float yOffset, float zOffset, bool useRelative)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            List <PositionAngle> posAngles = new List <PositionAngle> {
                PositionAngle.MapFocus
            };

            return(ButtonUtilities.ChangeValues(posAngles, xOffset, yOffset, zOffset, ButtonUtilities.Change.ADD, useRelative));
        }
Example #5
0
        public void GoToClosestVertex()
        {
            uint floorTri = Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset);

            if (floorTri == 0)
            {
                return;
            }
            ButtonUtilities.GotoTriangleVertexClosest(floorTri);
        }
Example #6
0
        public override void Update(bool updateView)
        {
            switch (Mode)
            {
            case TriangleMode.Floor:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset;
                SetTriangleAddresses(Config.Stream.GetUInt(TrianglePointerAddress.Value));
                break;

            case TriangleMode.Wall:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.WallTriangleOffset;
                SetTriangleAddresses(Config.Stream.GetUInt(TrianglePointerAddress.Value));
                break;

            case TriangleMode.Ceiling:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.CeilingTriangleOffset;
                SetTriangleAddresses(Config.Stream.GetUInt(TrianglePointerAddress.Value));
                break;

            case TriangleMode.MapHover:
                TrianglePointerAddress = null;
                SetTriangleAddresses(MapObjectHoverData.LastTriangleAddress);
                break;

            default:
                TrianglePointerAddress = null;
                break;
            }

            if (_checkBoxNeutralizeTriangle.Checked)
            {
                ButtonUtilities.NeutralizeTriangle(TriangleAddresses);
            }

            if (_recordTriangleDataCheckbox.Checked)
            {
                foreach (uint triangleAddress in TriangleAddresses)
                {
                    bool hasAlready = _recordedTriangleAddresses.Any(recordedAddress => triangleAddress == recordedAddress);
                    if (!hasAlready)
                    {
                        _recordedTriangleAddresses.Add(triangleAddress);
                    }
                }
            }

            if (!updateView)
            {
                return;
            }

            _recordTriangleCountLabel.Text = _recordedTriangleAddresses.Count.ToString();

            base.Update(updateView);
        }
Example #7
0
        public static void DisableAllCamCollision()
        {
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                //float ynorm = Config.Stream.GetSingle(address + Config.TriangleOffsets.NormY);
                //if (ynorm <= 0.01 && ynorm >= -0.01)
                //{
                ButtonUtilities.DisableCamCollisionForTriangle(address);
                //}
            });
        }
Example #8
0
        private void Annihilate()
        {
            List <DataGridViewRow> rows = ControlUtilities.GetTableSelectedRows(dataGridView);

            rows.ForEach(row =>
            {
                uint address = ParsingUtilities.ParseHex(row.Cells[0].Value);
                ButtonUtilities.AnnihilateTriangle(new List <uint>()
                {
                    address
                });
            });
        }
Example #9
0
        public static void NeutralizeTriangles(short surfaceType)
        {
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                short type = Config.Stream.GetInt16(address + TriangleOffsetsConfig.SurfaceType);
                if (type == surfaceType)
                {
                    ButtonUtilities.NeutralizeTriangle(address);
                }
            });
        }
Example #10
0
        public static void DisableCamCollision(TriangleClassification?classification = null)
        {
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                float ynorm = Config.Stream.GetSingle(address + TriangleOffsetsConfig.NormY);
                TriangleClassification triClassification = CalculateClassification(ynorm);
                if (classification == null || classification == triClassification)
                {
                    ButtonUtilities.DisableCamCollisionForTriangle(address);
                }
            });
        }
Example #11
0
        public override void Update(bool updateView)
        {
            _triangleCache.Clear();
            switch (Mode)
            {
            case TriangleMode.Ceiling:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.CeilingTriangleOffset;
                TriangleAddress        = Config.Stream.GetUInt32(TrianglePointerAddress);
                break;

            case TriangleMode.Floor:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset;
                TriangleAddress        = Config.Stream.GetUInt32(TrianglePointerAddress);
                break;

            case TriangleMode.Wall:
                TrianglePointerAddress = MarioConfig.StructAddress + MarioConfig.WallTriangleOffset;
                TriangleAddress        = Config.Stream.GetUInt32(TrianglePointerAddress);
                break;

            default:
                TrianglePointerAddress = 0;
                break;
            }

            if (_checkBoxNeutralizeTriangle.Checked && TriangleAddress != 0)
            {
                ButtonUtilities.NeutralizeTriangle(TriangleAddress);
            }

            if (_recordTriangleDataCheckbox.Checked && TriangleAddress != 0)
            {
                short[] coordinates = GetTriangleCoordinates();
                bool    hasAlready  = _triangleData.Any(coords => Enumerable.SequenceEqual(coords, coordinates));
                if (!hasAlready)
                {
                    _triangleData.Add(coordinates);
                }
            }

            if (!updateView)
            {
                return;
            }

            _recordTriangleCountLabel.Text = _triangleData.Count.ToString();

            base.Update(updateView);
        }
Example #12
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            _numSnowParticles     = 0;
            _snowParticleControls = new List <List <WatchVariableControl> >();


            buttonSnowRetrieve.Click += (sender, e) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.RetrieveSnow(snowIndex);
            };

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxSnowPosition,
                "SnowPosition",
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.TranslateSnow(
                    snowIndex,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Example #13
0
        public override void Update(bool updateView)
        {
            if (_checkBoxFullHP.Checked)
            {
                ButtonUtilities.FullHp();
            }

            if (!updateView)
            {
                return;
            }

            _turnOnOffHudButton.UpdateButton();

            base.Update(updateView);
        }
Example #14
0
        public static void NeutralizeTriangles(TriangleClassification?classification = null)
        {
            List <uint> triangleAddresses = GetLevelTriangleAddresses();

            triangleAddresses.ForEach(address =>
            {
                float ynorm = Config.Stream.GetSingle(address + TriangleOffsetsConfig.NormY);
                TriangleClassification triClassification = CalculateClassification(ynorm);
                if (classification == null || classification == triClassification)
                {
                    ButtonUtilities.NeutralizeTriangle(new List <uint>()
                    {
                        address
                    });
                }
            });
        }
Example #15
0
        public bool TranslateMapCameraSpherical(float radiusOffset, float thetaOffset, float phiOffset)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            ButtonUtilities.HandleScaling(ref thetaOffset, ref phiOffset);

            (double newX, double newY, double newZ) =
                MoreMath.OffsetSphericallyAboutPivot(
                    SpecialConfig.Map3DCameraX, SpecialConfig.Map3DCameraY, SpecialConfig.Map3DCameraZ,
                    radiusOffset, thetaOffset, phiOffset,
                    SpecialConfig.Map3DFocusX, SpecialConfig.Map3DFocusY, SpecialConfig.Map3DFocusZ);

            SpecialConfig.Map3DCameraX = (float)newX;
            SpecialConfig.Map3DCameraY = (float)newY;
            SpecialConfig.Map3DCameraZ = (float)newZ;

            return(true);
        }
Example #16
0
        public static void AnnihilateAllCeilings()
        {
            bool streamAlreadySuspended = Config.Stream.IsSuspended;

            if (!streamAlreadySuspended)
            {
                Config.Stream.Suspend();
            }
            List <uint> ceilingAddresses = GetLevelTriangles()
                                           .FindAll(tri => tri.IsCeiling())
                                           .ConvertAll(tri => tri.Address);

            ButtonUtilities.AnnihilateTriangle(ceilingAddresses);
            if (!streamAlreadySuspended)
            {
                Config.Stream.Resume();
            }
        }
Example #17
0
        public HudManager(string varFilePath, Control tabControl, WatchVariableFlowLayoutPanel watchVariablePanelHud)
            : base(varFilePath, watchVariablePanelHud)
        {
            _tabControl = tabControl;

            SplitContainer splitContainerHud = tabControl.Controls["splitContainerHud"] as SplitContainer;

            (splitContainerHud.Panel1.Controls["buttonFullHp"] as Button).Click      += (sender, e) => ButtonUtilities.FullHp();
            (splitContainerHud.Panel1.Controls["buttonDie"] as Button).Click         += (sender, e) => ButtonUtilities.Die();
            (splitContainerHud.Panel1.Controls["buttonGameOver"] as Button).Click    += (sender, e) => ButtonUtilities.GameOver();
            (splitContainerHud.Panel1.Controls["button99Coins"] as Button).Click     += (sender, e) => ButtonUtilities.Coins99();
            (splitContainerHud.Panel1.Controls["button100CoinStar"] as Button).Click += (sender, e) => ButtonUtilities.CoinStar100();
            (splitContainerHud.Panel1.Controls["button100Lives"] as Button).Click    += (sender, e) => ButtonUtilities.Lives100();
            (splitContainerHud.Panel1.Controls["buttonStandardHud"] as Button).Click += (sender, e) => ButtonUtilities.StandardHud();

            _turnOnOffHudButton = splitContainerHud.Panel1.Controls["buttonTurnOnOffHud"] as BinaryButton;
            _turnOnOffHudButton.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                _turnOnOffHudButton,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });

            _checkBoxFullHP = splitContainerHud.Panel1.Controls["checkBoxFullHP"] as CheckBox;
        }
Example #18
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            // Hud Image
            pictureBoxHud.Image      = Config.ObjectAssociations.HudImage.Value;
            panelHudBorder.BackColor = Config.ObjectAssociations.HudColor;
            pictureBoxHud.BackColor  = Config.ObjectAssociations.HudColor.Lighten(0.5);

            buttonFullHp.Click      += (sender, e) => ButtonUtilities.FullHp();
            buttonDie.Click         += (sender, e) => ButtonUtilities.Die();
            buttonGameOver.Click    += (sender, e) => ButtonUtilities.GameOver();
            button99Coins.Click     += (sender, e) => ButtonUtilities.Coins99();
            button100CoinStar.Click += (sender, e) => ButtonUtilities.CoinStar100();
            button100Lives.Click    += (sender, e) => ButtonUtilities.Lives100();
            buttonStandardHud.Click += (sender, e) => ButtonUtilities.StandardHud();

            buttonTurnOnOffHud.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTurnOnOffHud,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });
        }
Example #19
0
        public HudManager(List <WatchVariable> hudData, Control tabControl, NoTearFlowLayoutPanel noTearFlowLayoutPanelHud)
            : base(hudData, noTearFlowLayoutPanelHud)
        {
            _tabControl = tabControl;

            SplitContainer splitContainerHud = tabControl.Controls["splitContainerHud"] as SplitContainer;

            (splitContainerHud.Panel1.Controls["buttonFullHp"] as Button).Click      += (sender, e) => ButtonUtilities.FullHp();
            (splitContainerHud.Panel1.Controls["buttonDie"] as Button).Click         += (sender, e) => ButtonUtilities.Die();
            (splitContainerHud.Panel1.Controls["button99Coins"] as Button).Click     += (sender, e) => ButtonUtilities.Coins99();
            (splitContainerHud.Panel1.Controls["button100Lives"] as Button).Click    += (sender, e) => ButtonUtilities.Lives100();
            (splitContainerHud.Panel1.Controls["buttonStandardHud"] as Button).Click += (sender, e) => ButtonUtilities.StandardHud();

            _turnOnOffHudButton = splitContainerHud.Panel1.Controls["buttonTurnOnOffHud"] as BinaryButton;
            _turnOnOffHudButton.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(Config.Mario.StructAddress + Config.Hud.VisibilityOffset) & Config.Hud.VisibilityMask) == 0);

            _checkBoxFullHP = splitContainerHud.Panel1.Controls["checkBoxFullHP"] as CheckBox;
        }
Example #20
0
        public ObjectManager(List <WatchVariableControlPrecursor> variables, Control objectControl, WatchVariablePanel variableTable)
            : base(variables, variableTable, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerObject = objectControl.Controls["splitContainerObject"] as SplitContainer;

            _objAddressLabelValue    = splitContainerObject.Panel1.Controls["labelObjAddValue"] as Label;
            _objAddressLabel         = splitContainerObject.Panel1.Controls["labelObjAdd"] as Label;
            _objSlotIndexLabel       = splitContainerObject.Panel1.Controls["labelObjSlotIndValue"] as Label;
            _objSlotPositionLabel    = splitContainerObject.Panel1.Controls["labelObjSlotPosValue"] as Label;
            _objBehaviorLabel        = splitContainerObject.Panel1.Controls["labelObjBhvValue"] as Label;
            _objBehaviorLabel.Click += _objBehaviorLabel_Click;
            _objectNameTextBox       = splitContainerObject.Panel1.Controls["textBoxObjName"] as TextBox;
            _objectBorderPanel       = splitContainerObject.Panel1.Controls["panelObjectBorder"] as Panel;
            _objectImagePictureBox   = _objectBorderPanel.Controls["pictureBoxObject"] as IntPictureBox;

            _objAddressLabelValue.Click += ObjAddressLabel_Click;
            _objAddressLabel.Click      += ObjAddressLabel_Click;

            Panel objPanel = splitContainerObject.Panel1.Controls["panelObj"] as Panel;

            var goToButton = objPanel.Controls["buttonObjGoto"] as Button;

            goToButton.Click += (sender, e) => ButtonUtilities.GotoObjects(_currentAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                goToButton,
                new List <string>()
            {
                "Goto", "Goto Laterally", "Goto X", "Goto Y", "Goto Z"
            },
                new List <Action>()
            {
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, true, true)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, false, true)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, false, false)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (false, true, false)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (false, false, true)),
            });
Example #21
0
        public bool TranslateMapFocusSpherical(float radiusOffset, float thetaOffset, float phiOffset)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            ButtonUtilities.HandleScaling(ref thetaOffset, ref phiOffset);

            if (SpecialConfig.Map3DMode == Map3DCameraMode.CameraPosAndAngle)
            {
                SpecialConfig.Map3DCameraYaw   += thetaOffset;
                SpecialConfig.Map3DCameraPitch += phiOffset;
                return(true);
            }

            (double newX, double newY, double newZ) =
                MoreMath.OffsetSphericallyAboutPivot(
                    SpecialConfig.Map3DFocusX, SpecialConfig.Map3DFocusY, SpecialConfig.Map3DFocusZ,
                    radiusOffset, thetaOffset, phiOffset,
                    SpecialConfig.Map3DCameraX, SpecialConfig.Map3DCameraY, SpecialConfig.Map3DCameraZ);

            SpecialConfig.Map3DFocusX = (float)newX;
            SpecialConfig.Map3DFocusY = (float)newY;
            SpecialConfig.Map3DFocusZ = (float)newZ;

            return(true);
        }
Example #22
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            CurrentCamHackMode = CamHackMode.REGULAR;

            ControlUtilities.AddContextMenuStripFunctions(
                labelCamHackMode,
                new List <string>()
            {
                "Download Camera Hack ROM"
            },
                new List <Action>()
            {
                () => System.Diagnostics.Process.Start("http://download1436.mediafire.com/t3unklq170ag/hdd377v5794u319/Camera+Hack+ROM.z64"),
            });


            radioButtonCamHackMode0.Click += (sender, e) => Config.Stream.SetValue(0, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            radioButtonCamHackMode1RelativeAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)0, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            radioButtonCamHackMode1AbsoluteAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)1, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            radioButtonCamHackMode2.Click += (sender, e) => Config.Stream.SetValue(2, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            radioButtonCamHackMode3.Click += (sender, e) => Config.Stream.SetValue(3, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxCameraHackPos,
                buttonCameraHackPosXn,
                buttonCameraHackPosXp,
                buttonCameraHackPosZn,
                buttonCameraHackPosZp,
                buttonCameraHackPosXnZn,
                buttonCameraHackPosXnZp,
                buttonCameraHackPosXpZn,
                buttonCameraHackPosXpZp,
                buttonCameraHackPosYp,
                buttonCameraHackPosYn,
                textBoxCameraHackPosXZ,
                textBoxCameraHackPosY,
                checkBoxCameraHackPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHack(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                groupBoxCameraHackSphericalPos,
                buttonCameraHackSphericalPosTn,
                buttonCameraHackSphericalPosTp,
                buttonCameraHackSphericalPosPn,
                buttonCameraHackSphericalPosPp,
                buttonCameraHackSphericalPosTnPn,
                buttonCameraHackSphericalPosTnPp,
                buttonCameraHackSphericalPosTpPn,
                buttonCameraHackSphericalPosTpPp,
                buttonCameraHackSphericalPosRn,
                buttonCameraHackSphericalPosRp,
                textBoxCameraHackSphericalPosTP,
                textBoxCameraHackSphericalPosR,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackSpherically(
                    CurrentCamHackMode,
                    -1 * nOffset,
                    hOffset,
                    vOffset);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxCameraHackFocusPos,
                buttonCameraHackFocusPosXn,
                buttonCameraHackFocusPosXp,
                buttonCameraHackFocusPosZn,
                buttonCameraHackFocusPosZp,
                buttonCameraHackFocusPosXnZn,
                buttonCameraHackFocusPosXnZp,
                buttonCameraHackFocusPosXpZn,
                buttonCameraHackFocusPosXpZp,
                buttonCameraHackFocusPosYp,
                buttonCameraHackFocusPosYn,
                textBoxCameraHackFocusPosXZ,
                textBoxCameraHackFocusPosY,
                checkBoxCameraHackFocusPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackFocus(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                groupBoxCameraHackSphericalFocusPos,
                buttonCameraHackSphericalFocusPosTn,
                buttonCameraHackSphericalFocusPosTp,
                buttonCameraHackSphericalFocusPosPp,
                buttonCameraHackSphericalFocusPosPn,
                buttonCameraHackSphericalFocusPosTnPp,
                buttonCameraHackSphericalFocusPosTnPn,
                buttonCameraHackSphericalFocusPosTpPp,
                buttonCameraHackSphericalFocusPosTpPn,
                buttonCameraHackSphericalFocusPosRp,
                buttonCameraHackSphericalFocusPosRn,
                textBoxCameraHackSphericalFocusPosTP,
                textBoxCameraHackSphericalFocusPosR,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackFocusSpherically(
                    CurrentCamHackMode,
                    nOffset,
                    hOffset,
                    vOffset);
            });

            var cameraHackBothPosGroupBox = splitContainerCamHack.Panel1.Controls["groupBoxCameraHackBothPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackBothPosGroupBox,
                buttonCameraHackBothPosXn,
                buttonCameraHackBothPosXp,
                buttonCameraHackBothPosZn,
                buttonCameraHackBothPosZp,
                buttonCameraHackBothPosXnZn,
                buttonCameraHackBothPosXnZp,
                buttonCameraHackBothPosXpZn,
                buttonCameraHackBothPosXpZp,
                buttonCameraHackBothPosYp,
                buttonCameraHackBothPosYn,
                textBoxCameraHackBothPosXZ,
                textBoxCameraHackBothPosY,
                checkBoxCameraHackBothPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackBoth(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Example #23
0
        public TriangleManager(Control tabControl, string varFilePath, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            _recordedTriangleAddresses = new List <uint>();

            SplitContainer splitContainerTriangles = tabControl.Controls["splitContainerTriangles"] as SplitContainer;

            _addressBox = splitContainerTriangles.Panel1.Controls["textBoxCustomTriangle"] as BetterTextbox;
            _useMisalignmentOffsetCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxVertexMisalignment"] as CheckBox;

            _addressBox.AddEnterAction(() => AddressBoxEnter());

            _radioButtonTriFloor          = splitContainerTriangles.Panel1.Controls["radioButtonTriFloor"] as RadioButton;
            _radioButtonTriFloor.Click   += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor);
            _radioButtonTriWall           = splitContainerTriangles.Panel1.Controls["radioButtonTriWall"] as RadioButton;
            _radioButtonTriWall.Click    += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall);
            _radioButtonTriCeiling        = splitContainerTriangles.Panel1.Controls["radioButtonTriCeiling"] as RadioButton;
            _radioButtonTriCeiling.Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling);
            _radioButtonTriCustom         = splitContainerTriangles.Panel1.Controls["radioButtonTriCustom"] as RadioButton;
            _radioButtonTriCustom.Click  += (sender, e) => Mode_Click(sender, e, TriangleMode.Custom);

            ControlUtilities.AddContextMenuStripFunctions(
                _radioButtonTriCustom,
                new List <string>()
            {
                "Paste Addresses",
            },
                new List <Action>()
            {
                () => EnterCustomText(Clipboard.GetText()),
            });

            Label labelTriangleSelection = splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelTriangleSelection,
                new List <string>()
            {
                "Update Based on Coordinates",
                "Paste Triangles",
            },
                new List <Action>()
            {
                () => UpdateBasedOnCoordinates(),
                () => PasteTriangles(),
            });

            (splitContainerTriangles.Panel1.Controls["buttonGotoV1"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 1, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV2"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 2, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV3"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 3, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoVClosest"] as Button).Click += (sender, e) =>
                                                                                               ButtonUtilities.GotoTriangleVertexClosest(TriangleAddresses[0], _useMisalignmentOffsetCheckbox.Checked);

            (splitContainerTriangles.Panel1.Controls["buttonRetrieveTriangle"] as Button).Click
                += (sender, e) => ButtonUtilities.RetrieveTriangle(TriangleAddresses);

            Button buttonNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["buttonNeutralizeTriangle"] as Button;

            buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonNeutralizeTriangle,
                new List <string>()
            {
                "Neutralize", "Neutralize with 0", "Neutralize with 0x15"
            },
                new List <Action>()
            {
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, false),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, true),
            });

            Button buttonAnnihilateTriangle = splitContainerTriangles.Panel1.Controls["buttonAnnihilateTriangle"] as Button;

            buttonAnnihilateTriangle.Click += (sender, e) => ButtonUtilities.AnnihilateTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonAnnihilateTriangle,
                new List <string>()
            {
                "Annihilate All Tri But Death Barriers",
                "Annihilate All Ceilings",
            },
                new List <Action>()
            {
                () => TriangleUtilities.AnnihilateAllTrianglesButDeathBarriers(),
                () => TriangleUtilities.AnnihilateAllCeilings(),
            });

            var trianglePosGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTrianglePos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                trianglePosGroupBox,
                trianglePosGroupBox.Controls["buttonTrianglePosXn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYn"] as Button,
                trianglePosGroupBox.Controls["textBoxTrianglePosXZ"] as TextBox,
                trianglePosGroupBox.Controls["textBoxTrianglePosY"] as TextBox,
                trianglePosGroupBox.Controls["checkBoxTrianglePosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.MoveTriangle(
                    TriangleAddresses,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var triangleNormalGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTriangleNormal"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                triangleNormalGroupBox.Controls["buttontriangleNormalN"] as Button,
                triangleNormalGroupBox.Controls["buttontriangleNormalP"] as Button,
                triangleNormalGroupBox.Controls["textBoxTriangleNormal"] as TextBox,
                (float normalValue) =>
            {
                ButtonUtilities.MoveTriangleNormal(TriangleAddresses, normalValue);
            });

            _checkBoxNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["checkBoxNeutralizeTriangle"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowCoords"] as Button).Click
                += (sender, e) => ShowTriangleCoordinates();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowEquation"] as Button).Click
                += (sender, e) => ShowTriangleEquation();

            _recordTriangleDataCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRecordTriangleData"] as CheckBox;
            _recordTriangleCountLabel   = splitContainerTriangles.Panel1.Controls["labelRecordTriangleCount"] as Label;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowData"] as Button).Click
                += (sender, e) => ShowTriangleData();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowVertices"] as Button).Click
                += (sender, e) => ShowTriangleVertices();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAddresses"] as Button).Click
                += (sender, e) => ShowTriangleAddresses();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleClearData"] as Button).Click
                += (sender, e) => ClearTriangleData();

            _repeatFirstVertexCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRepeatFirstVertex"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowLevelTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetLevelTriangles());

            Button buttonTriangleShowObjTris = splitContainerTriangles.Panel1.Controls["buttonTriangleShowObjTris"] as Button;

            buttonTriangleShowObjTris.Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles());
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleShowObjTris,
                new List <string>()
            {
                "Show All Object Tris", "Show Selected Object Tris"
            },
                new List <Action>()
            {
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles()),
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetSelectedObjectTriangles()),
            });

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAllTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetAllTriangles());

            var buttonTriangleNeutralizeAllTriangles = splitContainerTriangles.Panel1.Controls["buttonTriangleNeutralizeAllTriangles"] as Button;

            buttonTriangleNeutralizeAllTriangles.Click += (sender, e) => TriangleUtilities.NeutralizeTriangles();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleNeutralizeAllTriangles,
                new List <string>()
            {
                "Neutralize All Triangles",
                "Neutralize Wall Triangles",
                "Neutralize Floor Triangles",
                "Neutralize Ceiling Triangles",
                "Neutralize Death Barriers",
                "Neutralize Lava",
                "Neutralize Sleeping",
                "Neutralize Loading Zones"
            },
                new List <Action>()
            {
                () => TriangleUtilities.NeutralizeTriangles(),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling),
                () => TriangleUtilities.NeutralizeTriangles(0x0A),
                () => TriangleUtilities.NeutralizeTriangles(0x01),
                () => TriangleUtilities.NeutralizeSleeping(),
                () => {
                    TriangleUtilities.NeutralizeTriangles(0x1B);
                    TriangleUtilities.NeutralizeTriangles(0x1C);
                    TriangleUtilities.NeutralizeTriangles(0x1D);
                    TriangleUtilities.NeutralizeTriangles(0x1E);
                },
            });

            var buttonTriangleDisableAllCamCollision = splitContainerTriangles.Panel1.Controls["buttonTriangleDisableAllCamCollision"] as Button;

            buttonTriangleDisableAllCamCollision.Click += (sender, e) => TriangleUtilities.DisableCamCollision();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleDisableAllCamCollision,
                new List <string>()
            {
                "Disable Cam Collision for All Triangles",
                "Disable Cam Collision for Wall Triangles",
                "Disable Cam Collision for Floor Triangles",
                "Disable Cam Collision for Ceiling Triangles",
            },
                new List <Action>()
            {
                () => TriangleUtilities.DisableCamCollision(),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Wall),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Floor),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Ceiling),
            });

            GroupBox groupBoxTriangleTypeConversion        = splitContainerTriangles.Panel1.Controls["groupBoxTriangleTypeConversion"] as GroupBox;
            ComboBox comboBoxTriangleTypeConversionConvert = groupBoxTriangleTypeConversion.Controls["comboBoxTriangleTypeConversionConvert"] as ComboBox;
            TextBox  textBoxTriangleTypeConversionFromType = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionFromType"] as TextBox;
            TextBox  textBoxTriangleTypeConversionToType   = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionToType"] as TextBox;
            Button   buttonTriangleTypeConversionConvert   = groupBoxTriangleTypeConversion.Controls["buttonTriangleTypeConversionConvert"] as Button;

            comboBoxTriangleTypeConversionConvert.DataSource = EnumUtilities.GetEnumValues <TriangleClassificationExtended>(typeof(TriangleClassificationExtended));

            buttonTriangleTypeConversionConvert.Click += (sender, e) =>
            {
                TriangleClassificationExtended classification = (TriangleClassificationExtended)comboBoxTriangleTypeConversionConvert.SelectedItem;
                short?fromType = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionFromType.Text);
                short?toType   = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionToType.Text);
                if (!fromType.HasValue || !toType.HasValue)
                {
                    return;
                }
                TriangleUtilities.ConvertSurfaceTypes(classification, fromType.Value, toType.Value);
            };
        }
Example #24
0
        public SnowManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, TabPage tabPageSnow)
            : base(varFilePath, variableTable, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            _numSnowParticles     = 0;
            _snowParticleControls = new List <List <WatchVariableControl> >();

            SplitContainer splitContainerSnow = tabPageSnow.Controls["splitContainerSnow"] as SplitContainer;

            TextBox textBoxSnowIndex = splitContainerSnow.Panel1.Controls["textBoxSnowIndex"] as TextBox;

            Button buttonSnowRetrieve = splitContainerSnow.Panel1.Controls["buttonSnowRetrieve"] as Button;

            buttonSnowRetrieve.Click += (sender, e) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.RetrieveSnow(snowIndex);
            };

            GroupBox groupBoxSnowPosition = splitContainerSnow.Panel1.Controls["groupBoxSnowPosition"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxSnowPosition,
                groupBoxSnowPosition.Controls["buttonSnowPositionXn"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionXp"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionZn"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionZp"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionXnZn"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionXnZp"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionXpZn"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionXpZp"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionYp"] as Button,
                groupBoxSnowPosition.Controls["buttonSnowPositionYn"] as Button,
                groupBoxSnowPosition.Controls["textBoxSnowPositionXZ"] as TextBox,
                groupBoxSnowPosition.Controls["textBoxSnowPositionY"] as TextBox,
                groupBoxSnowPosition.Controls["checkBoxSnowPositionRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.TranslateSnow(
                    snowIndex,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
        public ObjectSlotFlowLayoutPanel()
        {
            ToolStripMenuItem itemSelectMarkedSlots = new ToolStripMenuItem("Select Marked Slots");

            itemSelectMarkedSlots.Click += (sender, e) =>
            {
                Config.ObjectSlotsManager.SelectedSlotsAddresses.Clear();
                Config.ObjectSlotsManager.SelectedSlotsAddresses.AddRange(Config.ObjectSlotsManager.MarkedSlotsAddresses);
            };

            ToolStripMenuItem itemSelectCopiedAddress = new ToolStripMenuItem("Select Copied Address");

            itemSelectCopiedAddress.Click += (sender, e) =>
            {
                uint?address = ParsingUtilities.ParseHexNullable(Clipboard.GetText());
                if (address.HasValue)
                {
                    Config.ObjectSlotsManager.SelectSlotByAddress(address.Value);
                }
            };

            ToolStripMenuItem itemClearMarkedSlots = new ToolStripMenuItem("Clear Marked Slots");

            itemClearMarkedSlots.Click += (sender, e) =>
            {
                Config.ObjectSlotsManager.MarkedSlotsAddresses.Clear();
                Config.ObjectSlotsManager.MarkedSlotsAddressesDictionary.Clear();
            };

            ToolStripMenuItem itemClearSelectedSlots = new ToolStripMenuItem("Clear Selected Slots");

            itemClearSelectedSlots.Click += (sender, e) =>
            {
                Config.ObjectSlotsManager.SelectedSlotsAddresses.Clear();
            };

            ToolStripMenuItem itemUnloadAllButMarkedSlots = new ToolStripMenuItem("Unload All but Marked Slots");

            itemUnloadAllButMarkedSlots.Click += (sender, e) =>
            {
                List <ObjectDataModel> objsToUnload =
                    DataModels.ObjectProcessor.Objects.ToList().FindAll(
                        obj => !Config.ObjectSlotsManager.MarkedSlotsAddresses.Contains(obj.Address));
                ButtonUtilities.UnloadObject(objsToUnload);
            };

            ToolStripMenuItem itemFixHorizontalScroll = new ToolStripMenuItem("Fix Horizontal Scroll");

            itemFixHorizontalScroll.Click += (sender, e) =>
            {
                List <Control> controls = new List <Control>();
                foreach (Control control in Controls)
                {
                    controls.Add(control);
                }
                while (Controls.Count > 0)
                {
                    Controls.RemoveAt(0);
                }
                foreach (Control control in controls)
                {
                    Controls.Add(control);
                }
            };

            ContextMenuStrip = new ContextMenuStrip();
            ContextMenuStrip.Items.Add(itemSelectMarkedSlots);
            ContextMenuStrip.Items.Add(itemSelectCopiedAddress);
            ContextMenuStrip.Items.Add(itemClearMarkedSlots);
            ContextMenuStrip.Items.Add(itemClearSelectedSlots);
            ContextMenuStrip.Items.Add(itemUnloadAllButMarkedSlots);
            ContextMenuStrip.Items.Add(itemFixHorizontalScroll);
        }
Example #26
0
        public TasManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerTas = tabControl.Controls["splitContainerTas"] as SplitContainer;

            Button buttonTasStorePosition = splitContainerTas.Panel1.Controls["buttonTasStorePosition"] as Button;

            buttonTasStorePosition.Click += (sender, e) => StoreInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStorePosition,
                new List <string>()
            {
                "Store Position",
                "Store Lateral Position",
                "Store X",
                "Store Y",
                "Store Z",
            },
                new List <Action>()
            {
                () => StoreInfo(x: true, y: true, z: true),
                () => StoreInfo(x: true, z: true),
                () => StoreInfo(x: true),
                () => StoreInfo(y: true),
                () => StoreInfo(z: true),
            });

            Button buttonTasStoreAngle = splitContainerTas.Panel1.Controls["buttonTasStoreAngle"] as Button;

            buttonTasStoreAngle.Click += (sender, e) => StoreInfo(angle: true);

            Button buttonTasTakePosition = splitContainerTas.Panel1.Controls["buttonTasTakePosition"] as Button;

            buttonTasTakePosition.Click += (sender, e) => TakeInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasTakePosition,
                new List <string>()
            {
                "Take Position",
                "Take Lateral Position",
                "Take X",
                "Take Y",
                "Take Z"
            },
                new List <Action>()
            {
                () => TakeInfo(x: true, y: true, z: true),
                () => TakeInfo(x: true, z: true),
                () => TakeInfo(x: true),
                () => TakeInfo(y: true),
                () => TakeInfo(z: true),
            });

            Button buttonTasTakeMarioAngle = splitContainerTas.Panel1.Controls["buttonTasTakeAngle"] as Button;

            buttonTasTakeMarioAngle.Click += (sender, e) => TakeInfo(angle: true);

            Button buttonTasGotoVertex = splitContainerTas.Panel1.Controls["buttonTasGotoVertex"] as Button;

            buttonTasGotoVertex.Click += (sender, e) =>
                                         ButtonUtilities.GotoTriangleVertexClosest(
                Config.Stream.GetUInt(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset),
                TriangleVertexOffset.NONE);

            Button buttonTasPasteSchedule = splitContainerTas.Panel1.Controls["buttonTasPasteSchedule"] as Button;

            buttonTasPasteSchedule.Click += (sender, e) => SetScheduler(Clipboard.GetText(), false);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasPasteSchedule,
                new List <string>()
            {
                "Paste Schedule as Floats"
            },
                new List <Action>()
            {
                () => SetScheduler(Clipboard.GetText(), true)
            });

            GroupBox groupBoxTasSelf = splitContainerTas.Panel1.Controls["groupBoxTasSelf"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxTasSelf,
                groupBoxTasSelf.Controls["buttonTasSelfXn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXnZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXnZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXpZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXpZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfYp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfYn"] as Button,
                groupBoxTasSelf.Controls["textBoxTasSelfXZ"] as TextBox,
                groupBoxTasSelf.Controls["textBoxTasSelfY"] as TextBox,
                groupBoxTasSelf.Controls["checkBoxTasSelfRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslatePosAngle(
                    new List <PositionAngle>()
                {
                    PositionAngle.Self
                },
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            GroupBox groupBoxTasPoint = splitContainerTas.Panel1.Controls["groupBoxTasPoint"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxTasPoint,
                groupBoxTasPoint.Controls["buttonTasPointXn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXnZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXnZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXpZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXpZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointYp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointYn"] as Button,
                groupBoxTasPoint.Controls["textBoxTasPointXZ"] as TextBox,
                groupBoxTasPoint.Controls["textBoxTasPointY"] as TextBox,
                groupBoxTasPoint.Controls["checkBoxTasPointRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslatePosAngle(
                    new List <PositionAngle>()
                {
                    PositionAngle.Point
                },
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Example #27
0
        public CamHackManager(string varFilePath, TabPage camHackControl, WatchVariableFlowLayoutPanel variableTable)
            : base(varFilePath, variableTable)
        {
            CurrentCamHackMode = CamHackMode.REGULAR;

            var splitContainer = camHackControl.Controls["splitContainerCamHack"] as SplitContainer;

            Label labelCamHackMode = splitContainer.Panel1.Controls["labelCamHackMode"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelCamHackMode,
                new List <string>()
            {
                "Download Camera Hack ROM"
            },
                new List <Action>()
            {
                () => System.Diagnostics.Process.Start("http://download1436.mediafire.com/t3unklq170ag/hdd377v5794u319/Camera+Hack+ROM.z64"),
            });

            _mode0RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode0"] as RadioButton;
            _mode1RadioButtonRelativeAngle = splitContainer.Panel1.Controls["radioButtonCamHackMode1RelativeAngle"] as RadioButton;
            _mode1RadioButtonAbsoluteAngle = splitContainer.Panel1.Controls["radioButtonCamHackMode1AbsoluteAngle"] as RadioButton;
            _mode2RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode2"] as RadioButton;
            _mode3RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode3"] as RadioButton;

            _mode0RadioButton.Click += (sender, e) => Config.Stream.SetValue(0, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            _mode1RadioButtonRelativeAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)0, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            _mode1RadioButtonAbsoluteAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)1, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            _mode2RadioButton.Click += (sender, e) => Config.Stream.SetValue(2, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            _mode3RadioButton.Click += (sender, e) => Config.Stream.SetValue(3, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);

            var cameraHackPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackPosGroupBox,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXnZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXnZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXpZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXpZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosYp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosYn"] as Button,
                cameraHackPosGroupBox.Controls["textBoxCameraHackPosXZ"] as TextBox,
                cameraHackPosGroupBox.Controls["textBoxCameraHackPosY"] as TextBox,
                cameraHackPosGroupBox.Controls["checkBoxCameraHackPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHack(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var cameraHackSphericalPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackSphericalPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                cameraHackSphericalPosGroupBox,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTnPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTnPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTpPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTpPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosRn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosRp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["textBoxCameraHackSphericalPosTP"] as TextBox,
                cameraHackSphericalPosGroupBox.Controls["textBoxCameraHackSphericalPosR"] as TextBox,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackSpherically(
                    CurrentCamHackMode,
                    -1 * nOffset,
                    hOffset,
                    -1 * vOffset);
            });

            var cameraHackFocusPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackFocusPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackFocusPosGroupBox,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXnZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXnZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXpZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXpZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosYp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosYn"] as Button,
                cameraHackFocusPosGroupBox.Controls["textBoxCameraHackFocusPosXZ"] as TextBox,
                cameraHackFocusPosGroupBox.Controls["textBoxCameraHackFocusPosY"] as TextBox,
                cameraHackFocusPosGroupBox.Controls["checkBoxCameraHackFocusPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackFocus(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var cameraHackSphericalFocusPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackSphericalFocusPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                cameraHackSphericalFocusPosGroupBox,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTnPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTnPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTpPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTpPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosRp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosRn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["textBoxCameraHackSphericalFocusPosTP"] as TextBox,
                cameraHackSphericalFocusPosGroupBox.Controls["textBoxCameraHackSphericalFocusPosR"] as TextBox,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackFocusSpherically(
                    CurrentCamHackMode,
                    nOffset,
                    hOffset,
                    -1 * vOffset);
            });

            var cameraHackBothPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackBothPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackBothPosGroupBox,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXnZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXnZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXpZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXpZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosYp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosYn"] as Button,
                cameraHackBothPosGroupBox.Controls["textBoxCameraHackBothPosXZ"] as TextBox,
                cameraHackBothPosGroupBox.Controls["textBoxCameraHackBothPosY"] as TextBox,
                cameraHackBothPosGroupBox.Controls["checkBoxCameraHackBothPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackBoth(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Example #28
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            buttonTasStorePosition.Click += (sender, e) => StoreInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStorePosition,
                new List <string>()
            {
                "Store Position",
                "Store Lateral Position",
                "Store X",
                "Store Y",
                "Store Z",
                "Go to Closest Floor Vertex",
                "Go to Closest Floor Vertex Misalignment",
            },
                new List <Action>()
            {
                () => StoreInfo(x: true, y: true, z: true),
                () => StoreInfo(x: true, z: true),
                () => StoreInfo(x: true),
                () => StoreInfo(y: true),
                () => StoreInfo(z: true),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), false),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), true),
            });

            buttonTasStoreAngle.Click += (sender, e) => StoreInfo(angle: true);

            buttonTasTakePosition.Click += (sender, e) => TakeInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasTakePosition,
                new List <string>()
            {
                "Take Position",
                "Take Lateral Position",
                "Take X",
                "Take Y",
                "Take Z"
            },
                new List <Action>()
            {
                () => TakeInfo(x: true, y: true, z: true),
                () => TakeInfo(x: true, z: true),
                () => TakeInfo(x: true),
                () => TakeInfo(y: true),
                () => TakeInfo(z: true),
            });

            buttonTasTakeAngle.Click += (sender, e) => TakeInfo(angle: true);

            buttonTasPasteSchedule.Click += (sender, e) => SetScheduler(Clipboard.GetText(), false);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasPasteSchedule,
                new List <string>()
            {
                "Paste Schedule as Floats"
            },
                new List <Action>()
            {
                () => SetScheduler(Clipboard.GetText(), true)
            });
        }
Example #29
0
        public MarioManager(List <WatchVariableControlPrecursor> variables, Control marioControl, WatchVariablePanel variableTable)
            : base(variables, variableTable, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerMario = marioControl.Controls["splitContainerMario"] as SplitContainer;

            Button toggleHandsfree = splitContainerMario.Panel1.Controls["buttonMarioToggleHandsfree"] as Button;

            toggleHandsfree.Click += (sender, e) => ButtonUtilities.ToggleHandsfree();

            Button toggleVisibility = splitContainerMario.Panel1.Controls["buttonMarioVisibility"] as Button;

            toggleVisibility.Click += (sender, e) => ButtonUtilities.ToggleVisibility();

            var marioPosGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                marioPosGroupBox,
                marioPosGroupBox.Controls["buttonMarioPosXn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXnZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXnZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXpZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXpZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosYp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosYn"] as Button,
                marioPosGroupBox.Controls["textBoxMarioPosXZ"] as TextBox,
                marioPosGroupBox.Controls["textBoxMarioPosY"] as TextBox,
                marioPosGroupBox.Controls["checkBoxMarioPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateMario(
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var marioStatsGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioStats"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsYawN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsYawP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsYaw"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeYaw((int)Math.Round(value));
            });
            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsHspdN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsHspdP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsHspd"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeHspd(value);
            });
            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsVspdN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsVspdP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsVspd"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeVspd(value);
            });

            var marioSlidingSpeedGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioSlidingSpeed"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedXn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedXp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedX"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedX(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedZn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedZp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedZ"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedZ(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedHn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedHp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedH"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedH(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedYawN"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedYawP"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedYaw"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedYaw(value);
            });

            Button buttonMarioHOLPGoto = splitContainerMario.Panel1.Controls["buttonMarioHOLPGoto"] as Button;

            buttonMarioHOLPGoto.Click += (sender, e) => ButtonUtilities.GotoHOLP();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonMarioHOLPGoto,
                new List <string>()
            {
                "Goto HOLP", "Goto HOLP Laterally", "Goto HOLP X", "Goto HOLP Y", "Goto HOLP Z"
            },
                new List <Action>()
            {
                () => ButtonUtilities.GotoHOLP((true, true, true)),
                () => ButtonUtilities.GotoHOLP((true, false, true)),
                () => ButtonUtilities.GotoHOLP((true, false, false)),
                () => ButtonUtilities.GotoHOLP((false, true, false)),
                () => ButtonUtilities.GotoHOLP((false, false, true)),
            });
Example #30
0
        public void Initialize(List <WatchVariableControl> controls)
        {
            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxVar,
                groupBoxVar.Controls["buttonVarXn"] as Button,
                groupBoxVar.Controls["buttonVarXp"] as Button,
                groupBoxVar.Controls["buttonVarZn"] as Button,
                groupBoxVar.Controls["buttonVarZp"] as Button,
                groupBoxVar.Controls["buttonVarXnZn"] as Button,
                groupBoxVar.Controls["buttonVarXnZp"] as Button,
                groupBoxVar.Controls["buttonVarXpZn"] as Button,
                groupBoxVar.Controls["buttonVarXpZp"] as Button,
                groupBoxVar.Controls["buttonVarYp"] as Button,
                groupBoxVar.Controls["buttonVarYn"] as Button,
                groupBoxVar.Controls["textBoxVarXZ"] as TextBox,
                groupBoxVar.Controls["textBoxVarY"] as TextBox,
                groupBoxVar.Controls["checkBoxVarRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                if (controls.Count < 3)
                {
                    return;
                }

                List <List <object> > valueLists = new List <List <object> >()
                {
                    controls[0].GetValues(handleFormatting: false),
                    controls[1].GetValues(handleFormatting: false),
                    controls[2].GetValues(handleFormatting: false),
                };
                if (controls.Count >= 4)
                {
                    valueLists.Add(controls[3].GetValues(handleFormatting: false));
                }
                int minCount = valueLists.Min(valueList => valueList.Count);

                List <PositionAngle> posAngles = new List <PositionAngle>();
                for (int i = 0; i < minCount; i++)
                {
                    int index = i;
                    List <Func <double> > getters = new List <Func <double> >()
                    {
                        () => ParsingUtilities.ParseDouble(valueLists[0][index]),
                        () => ParsingUtilities.ParseDouble(valueLists[1][index]),
                        () => ParsingUtilities.ParseDouble(valueLists[2][index]),
                        () => controls.Count >= 4 ? ParsingUtilities.ParseDouble(valueLists[3][index]) : double.NaN,
                    };
                    List <Func <double, bool> > setters = new List <Func <double, bool> >()
                    {
                        (double value) => controls[0].SetValueOfValues(value, index),
                        (double value) => controls[1].SetValueOfValues(value, index),
                        (double value) => controls[2].SetValueOfValues(value, index),
                        (double value) => controls.Count >= 4 ? controls[3].SetValueOfValues(value, index) : true,
                    };
                    PositionAngle posAngle = PositionAngle.Functions(getters, setters);
                    posAngles.Add(posAngle);
                }
                ButtonUtilities.TranslatePosAngle(
                    posAngles,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }