Exemplo n.º 1
0
        public Olo.LayoutData GetLayoutData()
        {
            Olo.LayoutData data = new Olo.LayoutData();

            data.ObjectNameOffset = (decimal.ToUInt32(NumericObjectRefer.Value) * 0x10) + 0x40;
            data.UniqueID         = decimal.ToUInt32(NumericUniqueID.Value);
            data.Parameter1       = decimal.ToUInt16(NumericParam1.Value);
            data.Parameter2       = decimal.ToUInt16(NumericParam2.Value);
            data.Parameter3       = decimal.ToUInt16(NumericParam3.Value);
            data.Trigger          = decimal.ToUInt16(NumericTrigger.Value);
            data.MessageID        = decimal.ToInt32(NumericMessageID.Value);
            data.Parameter5       = float.Parse(Param5Box.Text);
            data.Parameter6       = float.Parse(Param6Box.Text);
            data.Parameter7       = float.Parse(Param7Box.Text);
            data.Parameter8       = float.Parse(Param8Box.Text);

            data.PositionX = float.Parse(PositionX.Text);
            data.PositionY = float.Parse(PositionY.Text);
            data.PositionZ = float.Parse(PositionZ.Text);
            data.RotationX = float.Parse(RotationX.Text);
            data.RotationY = float.Parse(RotationY.Text);
            data.RotationZ = float.Parse(RotationZ.Text);
            data.Height    = float.Parse(HeightBox.Text);

            data.LayoutInfo = Olo.MakeLayoutInfo(AppearCheckbox.Checked, LoadOnlyCheckbox.Checked, DeadCheckbox.Checked, (byte)NumericID.Value, ModelDisplayOffCheckbox.Checked,
                                                 (byte)NumericGroupID.Value, NoLoadCheckbox.Checked, (byte)NumericNetworkID.Value);

            data.MissionLabelOffset = MissionPos;
            data.ScriptNameOffset   = ScriptPos;
            data.PathNameOffset     = PathPos;

            return(data);
        }
Exemplo n.º 2
0
        private void SaveOLOButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "Object Layout files (*.olo)|*.olo|All files (*.*)|*.*";
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                Stream oloOut = File.OpenWrite(dialog.FileName);
                UpdateWriteInfo();
                Olo.Write(oloOut, olo);
                oloOut.Close();
                MessageBox.Show("File saved successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        public Olo.TriggerData GetTriggerData()
        {
            Olo.TriggerData trgData = new Olo.TriggerData();
            trgData.PositionX = float.Parse(TriggerLocX.Text);
            trgData.PositionY = float.Parse(TriggerLocY.Text);
            trgData.PositionZ = float.Parse(TriggerLocZ.Text);
            trgData.ScaleX    = float.Parse(TriggerScaleX.Text);
            trgData.ScaleY    = float.Parse(TriggerScaleY.Text);
            trgData.ScaleZ    = float.Parse(TriggerScaleZ.Text);
            trgData.Yaw       = float.Parse(TriggerYaw.Text);
            trgData.ID        = decimal.ToUInt32(NumericTriggerID.Value);
            trgData.Behavior  = Olo.MakeTriggerBehavior((Olo.TriggerType)TriggerTypeComboBox.SelectedIndex, (Olo.TriggerShape)TriggerShapeComboBox.SelectedIndex, FireCheckbox.Checked, StopCheckbox.Checked);
            trgData.CTDid     = decimal.ToUInt32(NumericCTDID.Value);
            trgData.TypeRef   = decimal.ToUInt32(NumericTriggerTID.Value);
            trgData.Param1    = decimal.ToUInt16(NumericUnkParam1.Value);
            trgData.Param2    = decimal.ToUInt16(NumericUnkParam2.Value);

            return(trgData);
        }
Exemplo n.º 4
0
 public void GetGroupData()
 {
     if (data != null)
     {
         data.CenterX   = float.Parse(CenterX.Text);
         data.CenterY   = float.Parse(CenterY.Text);
         data.CenterZ   = float.Parse(CenterZ.Text);
         data.Radius    = float.Parse(ObjectRadius.Text);
         data.TriggerID = decimal.ToUInt32(NumericAssociatedTrigger.Value);
         data.Flag      = Olo.MakeGroupFlag((Olo.AppearType)AppearTypeComboBox.SelectedIndex, GroupFlagCheckboxList.GetItemChecked(0), GroupFlagCheckboxList.GetItemChecked(1),
                                            GroupFlagCheckboxList.GetItemChecked(2), decimal.ToByte(NumericStep.Value), GroupFlagCheckboxList.GetItemChecked(3), decimal.ToByte(NumericID.Value), GroupFlagCheckboxList.GetItemChecked(4),
                                            GroupFlagCheckboxList.GetItemChecked(5), GroupFlagCheckboxList.GetItemChecked(6), GroupFlagCheckboxList.GetItemChecked(7), decimal.ToByte(NumericGroupID.Value));
         data.AppearParameter     = float.Parse(AppearParameterBox.Text);
         data.NextGroupDataOffset = 0;
         data.DeadRate            = float.Parse(DeadRateBox.Text);
         data.GameTrigger         = decimal.ToUInt16(NumericGameTrigger.Value);
         data.MissionParameter    = decimal.ToByte(NumericMissionParam.Value);
         data.UnkParameter        = decimal.ToByte(NumericUnknownParam.Value);
     }
 }
Exemplo n.º 5
0
        private void LoadOLOButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Object Layout files (*.olo)|*.olo|All files (*.*)|*.*";
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (oloFile != null)
                {
                    oloFile.Close();
                }
                oloFile = File.OpenRead(dialog.FileName);
                olo     = Olo.Read(oloFile);
                UpdateParameters();
                SaveOLOButton.Enabled    = true;
                OLOFlagsGBox.Enabled     = true;
                AddSectionButton.Enabled = true;
            }
        }
Exemplo n.º 6
0
        public void SetLayoutData(Olo.LayoutData data, int index)
        {
            GBox.Text = "Layout " + (index + 1);
            NumericObjectRefer.Value = (data.ObjectNameOffset - 0x40) / 0x10;
            NumericUniqueID.Value    = data.UniqueID;
            NumericParam1.Value      = data.Parameter1;
            NumericParam2.Value      = data.Parameter2;
            NumericParam3.Value      = data.Parameter3;
            NumericTrigger.Value     = data.Trigger;
            NumericMessageID.Value   = data.MessageID;
            Param5Box.Text           = data.Parameter5.ToString();
            Param6Box.Text           = data.Parameter6.ToString();
            Param7Box.Text           = data.Parameter7.ToString();
            Param8Box.Text           = data.Parameter8.ToString();

            PositionX.Text = data.PositionX.ToString();
            PositionY.Text = data.PositionY.ToString();
            PositionZ.Text = data.PositionZ.ToString();
            RotationX.Text = data.RotationX.ToString();
            RotationY.Text = data.RotationY.ToString();
            RotationZ.Text = data.RotationZ.ToString();
            HeightBox.Text = data.Height.ToString();

            Olo.LayoutInfo dt = Olo.GetLayoutInfo(data.LayoutInfo);

            AppearCheckbox.Checked          = dt.Appear;
            LoadOnlyCheckbox.Checked        = dt.LoadOnly;
            DeadCheckbox.Checked            = dt.Dead;
            ModelDisplayOffCheckbox.Checked = dt.ModelDisplayOff;
            NoLoadCheckbox.Checked          = dt.NoLoad;
            NumericID.Value        = dt.ID;
            NumericGroupID.Value   = dt.GroupID;
            NumericNetworkID.Value = dt.NetworkID;

            MissionPos = data.MissionLabelOffset;
            ScriptPos  = data.ScriptNameOffset;
            PathPos    = data.PathNameOffset;
        }
Exemplo n.º 7
0
        private void UpdateParameters()
        {
            FlowObjects.Controls.Clear();
            FlowFiles.Controls.Clear();
            FlowScripts.Controls.Clear();
            FlowMissions.Controls.Clear();
            FlowTriggers.Controls.Clear();
            FlowLayout.Controls.Clear();

            TabObjects.Text  = "Objects (" + olo.ObjectList.Count + ")";
            TabFilePath.Text = "Files (" + olo.FileList.Count + ")";
            TabScripts.Text  = "Scripts (" + olo.ScriptList.Count + ")";
            TabMissions.Text = "Missions (" + olo.MissionNameList.Count + ")";
            TabTriggers.Text = "Triggers (" + olo.TriggerList.Count + ")";
            TabLayout.Text   = "Layout (" + olo.header.GroupDataCount + ")";

            EnemyFlag.Checked        = BitsUtil.Int.GetBit(olo.header.Flag, 0);
            GimmickFlag.Checked      = BitsUtil.Int.GetBit(olo.header.Flag, 1);
            NPCFlag.Checked          = BitsUtil.Int.GetBit(olo.header.Flag, 2);
            PlayerFlag.Checked       = BitsUtil.Int.GetBit(olo.header.Flag, 3);
            EventTriggerFlag.Checked = BitsUtil.Int.GetBit(olo.header.Flag, 4);

            int i = 1;

            foreach (Olo.ObjectName obj in olo.ObjectList)
            {
                ObjectLoadedControl cObjectCon = new ObjectLoadedControl();
                cObjectCon.GBox.Text = "Object Loaded " + i;
                cObjectCon.ObjectLoadedComboBox.SelectedItem = Bbs.SystemData.GameObject.SpawnObjectList[obj.Name];
                FlowObjects.Controls.Add(cObjectCon);
                i++;
            }

            i = 1;
            foreach (Olo.PathName obj in olo.FileList)
            {
                PathNameControl cFileCon = new PathNameControl();
                cFileCon.GBox.Text         = "File Loaded " + i;
                cFileCon.PathNameText.Text = obj.Name;
                FlowFiles.Controls.Add(cFileCon);
                i++;
            }

            i = 1;
            foreach (Olo.PathName obj in olo.ScriptList)
            {
                PathNameControl cScriptCon = new PathNameControl();
                cScriptCon.GBox.Text         = "Script Loaded " + i;
                cScriptCon.PathNameText.Text = obj.Name;
                FlowScripts.Controls.Add(cScriptCon);
                i++;
            }

            i = 1;
            foreach (Olo.ObjectName obj in olo.MissionNameList)
            {
                ObjectNameControl cMissionCon = new ObjectNameControl();
                cMissionCon.GBox.Text           = "Mission Loaded " + i;
                cMissionCon.ObjectNameText.Text = obj.Name;
                FlowMissions.Controls.Add(cMissionCon);
                i++;
            }

            i = 1;
            foreach (Olo.TriggerData obj in olo.TriggerList)
            {
                TriggerDataControl cTriggerCon = new TriggerDataControl();
                cTriggerCon.GBox.Text               = "Trigger " + i;
                cTriggerCon.TriggerLocX.Text        = obj.PositionX.ToString();
                cTriggerCon.TriggerLocY.Text        = obj.PositionY.ToString();
                cTriggerCon.TriggerLocZ.Text        = obj.PositionZ.ToString();
                cTriggerCon.TriggerScaleX.Text      = obj.ScaleX.ToString();
                cTriggerCon.TriggerScaleY.Text      = obj.ScaleY.ToString();
                cTriggerCon.TriggerScaleZ.Text      = obj.ScaleZ.ToString();
                cTriggerCon.TriggerYaw.Text         = obj.Yaw.ToString();
                cTriggerCon.NumericTriggerID.Value  = obj.ID;
                cTriggerCon.NumericUnkParam1.Value  = obj.Param1;
                cTriggerCon.NumericUnkParam2.Value  = obj.Param2;
                cTriggerCon.NumericCTDID.Value      = obj.CTDid;
                cTriggerCon.NumericTriggerTID.Value = obj.TypeRef;

                Olo.TriggerBehavior behavior = Olo.GetTriggerBehavior(obj.Behavior);

                cTriggerCon.TriggerTypeComboBox.SelectedIndex  = (int)behavior.Type;
                cTriggerCon.TriggerShapeComboBox.SelectedIndex = (int)behavior.Shape;
                cTriggerCon.FireCheckbox.Checked = behavior.Fire;
                cTriggerCon.StopCheckbox.Checked = behavior.Stop;

                FlowTriggers.Controls.Add(cTriggerCon);
                i++;
            }

            i = 1;
            int j = 0;

            foreach (Olo.GroupData obj in olo.GroupList)
            {
                LayoutGroupControl cLayoutCon = new LayoutGroupControl();
                cLayoutCon.GBox.Text                 = "Group Layout " + i;
                cLayoutCon.data                      = obj;
                cLayoutCon.CenterX.Text              = obj.CenterX.ToString();
                cLayoutCon.CenterY.Text              = obj.CenterY.ToString();
                cLayoutCon.CenterZ.Text              = obj.CenterZ.ToString();
                cLayoutCon.ObjectRadius.Text         = obj.Radius.ToString();
                cLayoutCon.AppearParameterBox.Text   = obj.AppearParameter.ToString();
                cLayoutCon.DeadRateBox.Text          = obj.DeadRate.ToString();
                cLayoutCon.NumericGameTrigger.Value  = obj.GameTrigger;
                cLayoutCon.NumericMissionParam.Value = obj.MissionParameter;
                cLayoutCon.NumericUnknownParam.Value = obj.UnkParameter;

                var gFlag = Olo.GetGroupFlag(obj.Flag);
                cLayoutCon.AppearTypeComboBox.SelectedIndex = (int)gFlag.Type;
                cLayoutCon.NumericStep.Value    = gFlag.Step;
                cLayoutCon.NumericID.Value      = gFlag.ID;
                cLayoutCon.NumericGroupID.Value = gFlag.GroupID;

                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(0, gFlag.Linked);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(1, gFlag.AppearOK);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(2, gFlag.LinkInvoke);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(3, gFlag.Fire);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(4, gFlag.Specified);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(5, gFlag.GameTriggerFire);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(6, gFlag.MissionFire);
                cLayoutCon.GroupFlagCheckboxList.SetItemChecked(7, gFlag.AllDeadNoAppear);

                for (int p = 0; p < obj.ObjectLayoutDataCount; p++)
                {
                    LayoutDataControl cLayoutData = new LayoutDataControl();
                    cLayoutData.SetLayoutData(olo.LayoutList[j], j);
                    cLayoutCon.FlowLayout.Controls.Add(cLayoutData);
                    j++;
                }

                FlowLayout.Controls.Add(cLayoutCon);
                i++;
            }
        }