Ejemplo n.º 1
0
        private void FillBuiltIn(uint type, ListView list, TabPage tab)
        {
            list.Items.Clear();
            ListViewItem lvi;

            uint i = 0;

            foreach (string s in BhavWiz.readStr(pjse.GS.BhavStr.Primitives))
            {
                if (!s.StartsWith("~"))
                {
                    lvi     = new ListViewItem(new string[] { "0x" + SimPe.Helper.HexString((ushort)i), s });
                    lvi.Tag = i;
                    list.Items.Add(lvi);
                }
                i++;
            }

            this.tcResources.TabPages.Add(tab);
            list.ListViewItemSorter = new ListViewItemComparer();
            if (list.Items.Count > 0)
            {
                list.SelectedIndices.Add(0);
            }
        }
Ejemplo n.º 2
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                UInt32 val = Convert.ToUInt32(this.tbGUID.Text, 16);
                ops1[0x00] = (byte)(val & 0xff);
                ops1[0x01] = (byte)(val >> 8 & 0xff);
                ops1[0x02] = (byte)(val >> 16 & 0xff);
                ops1[0x03] = (byte)(val >> 24 & 0xff);
                if (this.cbToNext.SelectedIndex >= 0)
                {
                    ops1[0x04] = (byte)(this.cbToNext.SelectedIndex & 0x7f);
                }
                ops1[0x04] |= (byte)(!this.ckbStackObj.Checked ? 0x80 : 0x00);
                ops1[0x05]  = doid1.DataOwner;
                ops1[0x06]  = Convert.ToByte(this.tbLocalVar.Text, 16);
                ops1[0x07]  = (byte)(doid1.Value & 0xff);

                ops2[0x00] &= 0xfc;
                ops2[0x00] |= (byte)(this.ckbDisabled.Checked ? 0x01 : 0x00);
                ops2[0x00] |= (byte)(this.ckbWhere.Checked ? 0x02 : 0x00);
                if (this.cbWhere.SelectedIndex >= 0)
                {
                    BhavWiz.FromShort(ref ops2, 1, (ushort)this.cbWhere.SelectedIndex);
                }
                BhavWiz.FromShort(ref ops2, 3, (ushort)Convert.ToUInt32(this.tbWhereVal.Text, 16));
            }
            return(inst);
        }
Ejemplo n.º 3
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                Boolset options = (Boolset)(ops1[0x02] & 0xbf);
                int     scope   = this.cbScope.SelectedIndex;
                options[0]  = (scope == 2);
                options[1]  = (scope == 1);
                options[2]  = !this.tfGlobal.Checked;
                options[3]  = !this.tfSemiGlobal.Checked;
                options[4]  = this.tfArgs.Checked;
                options[5]  = this.tfParams.Checked;
                ops1[0x02]  = options;
                ops1[0x02] |= (byte)((doidTree.Value >> 2) & 0x40);

                ops1[0x04] = (byte)(doidTree.Value & 0xff);

                if (this.cbRTBNType.SelectedIndex >= 0)
                {
                    ops1[0x05] = (byte)this.cbRTBNType.SelectedIndex;
                }

                byte[] lohi = { 0, 0 };
                ops1[0x06] = ldocArg1.DataOwner; BhavWiz.FromShort(ref lohi, 0, ldocArg1.Value); ops1[0x07] = lohi[0]; ops2[0x00] = lohi[1];
                ops2[0x01] = ldocArg2.DataOwner; BhavWiz.FromShort(ref ops2, 2, ldocArg2.Value);
                ops2[0x04] = ldocArg3.DataOwner; BhavWiz.FromShort(ref ops2, 5, ldocArg3.Value);
            }
            return(inst);
        }
Ejemplo n.º 4
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                BhavWiz.FromShort(ref ops1, 0, doidAnim.Value);

                ops1[2] = getOptions(lckbOptions1, ops1[2]);

                BhavWiz.FromShort(ref ops1, 4, doidEvent.Value);
                byte[] lohi = { 0, 0 };

                switch (mode)
                {
                case "bwp_Object":
                    ops1[6] = doidObject.DataOwner;
                    BhavWiz.FromShort(ref lohi, 0, doidObject.Value);
                    ops1[7] = lohi[0];
                    ops2[0] = lohi[1];
                    ops2[1] = getScope(ops2[1]);
                    ops2[2] = getOptions(lckbOptions2, ops2[2]);
                    break;

                case "bwp_Sim":
                    ops1[6] = (byte)(doidAnimType.Value & 0xff);
                    ops1[7] = getScope(ops1[7]);
                    ops2[0] = getOptions(lckbOptions2, ops2[0]);
                    ops2[1] = doidIK.DataOwner;
                    BhavWiz.FromShort(ref ops2, 2, doidIK.Value);
                    ops2[4] = getPriority(ops2[4]);
                    break;

                case "bwp_Overlay":
                    ops1[6] = doidObject.DataOwner;
                    BhavWiz.FromShort(ref lohi, 0, doidObject.Value);
                    ops1[7] = lohi[0];
                    ops2[0] = lohi[1];
                    ops2[1] = (byte)(doidAnimType.Value & 0xff);

                    if (inst.NodeVersion != 0)
                    {
                        ops2[3] = getPriority(ops2[3]);
                        Boolset options3 = ops2[4];
                        options3[0] = ckbNotHurryable.Checked;
                        ops2[4]     = options3;
                    }
                    else
                    {
                        ops2[4] = getPriority(ops2[4]);
                    }

                    ops2[6] = getScope(ops2[6]);
                    ops2[7] = getOptions(lckbOptions2, ops2[7]);
                    break;
                }
            }
            return(inst);
        }
Ejemplo n.º 5
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1  = inst.Operands;
            wrappedByteArray ops2  = inst.Reserved1;
            Boolset          ops14 = ops1[4];

            //internalchg = true;

            doid1 = new DataOwnerControl(inst, null, null, this.tbVal1, this.ckbDecimal, null, null,
                                         0x07, BhavWiz.ToShort(ops1[0x00], ops1[0x01])); // Literal

            int i = 0;

            if (!ops14[1])
            {
                i = BhavWiz.ToShort(ops1[2], ops1[3]);
            }
            if (i < cbSlotType.Items.Count)
            {
                cbSlotType.SelectedIndex = i;
            }

            ckbNFailTrees.Checked      = ops14[0];
            ckbIgnDstFootprint.Checked = ops14[2];
            ckbDiffAlts.Checked        = ops14[3];

            //internalchg = false;
        }
Ejemplo n.º 6
0
 private void setGUID(bool setTB, UInt32 guid)
 {
     if (setTB)
     {
         this.tbGUID.Text = "0x" + SimPe.Helper.HexString(guid);
     }
     this.lbGUIDText.Text = BhavWiz.FormatGUID(true, guid);
 }
Ejemplo n.º 7
0
 private void setGUID(bool setTB, UInt32 guid)
 {
     if (setTB)
     {
         this.tbGUID.Text = "0x" + SimPe.Helper.HexString(guid);
     }
     this.tbObjName.Text = (guid == 0) ? BhavWiz.dnStkOb() : BhavWiz.FormatGUID(true, guid);
 }
Ejemplo n.º 8
0
        private void setInstanceLabel()
        {
            if (lbInstance != null)
            {
                string s = "";
                if (inst != null)
                {
                    List <string> labels = null;
                    if (useFlagNames && dataOwner == 0x07 && flagsFor != null)
                    {
                        labels = BhavWiz.flagNames(flagsFor.DataOwner, flagsFor.Value);
                        if (labels != null)
                        {
                            labels = new List <string>(labels);
                            labels.Insert(0, "[0: " + pjse.Localization.GetString("invalid") + "]");
                        }
                    }
                    else if (dataOwner == 0x00 || dataOwner == 0x01)
                    {
                        labels = inst.GetAttrNames(Scope.Private);
                    }
                    else if (dataOwner == 0x02 || dataOwner == 0x05)
                    {
                        labels = inst.GetAttrNames(Scope.SemiGlobal);
                    }
                    else if (dataOwner == 0x09 || dataOwner == 0x16 || dataOwner == 0x32) // Param
                    {
                        labels = inst.GetTPRPnames(false);
                    }
                    else if (dataOwner == 0x19) // Local
                    {
                        labels = inst.GetTPRPnames(true);
                    }
                    else if (dataOwner >= 0x29 && dataOwner <= 0x2F)
                    {
                        labels = inst.GetArrayNames();
                    }
                    else if (BhavWiz.doidGStr[dataOwner] != null)
                    {
                        labels = BhavWiz.readStr((GS.BhavStr)BhavWiz.doidGStr[dataOwner]);
                    }

                    if (labels != null)
                    {
                        if (instance < labels.Count)
                        {
                            s = cbDataOwner.Text + ": " + labels[instance];
                        }
                    }
                    else if (dataOwner == 0x1a)
                    {
                        ushort[] bcon = BhavWiz.ExpandBCON(instance, false);
                        s = ((BhavWiz)inst).readBcon(bcon[0], bcon[1], false, true);
                    }
                }
                lbInstance.Text = s;
            }
        }
Ejemplo n.º 9
0
        public UI()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            cbLocation.Items.AddRange(BhavWiz.readStr(GS.BhavStr.RelativeLocations).ToArray());
            cbDirection.Items.AddRange(BhavWiz.readStr(GS.BhavStr.RelativeDirections).ToArray());
        }
Ejemplo n.º 10
0
        private void updateOperands()
        {
            switch (format)
            {
            case BhavWizBhav.dataFormat.useTemps:
            case BhavWizBhav.dataFormat.oldFormat:
                if (format == BhavWizBhav.dataFormat.useTemps)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        operands[i] = 0xff;
                    }
                }
                else
                {
                    for (int i = 0; i < 8; i++)
                    {
                        BhavWiz.FromShort(ref operands, i * 2, aldoc[i].Value);
                    }
                }
                if (nodeVersion == 0)
                {
                    operands[12] &= 0xfe;
                }
                else
                {
                    if ((operands[12] & 0xfc) == 0xfc)
                    {
                        operands[12] = 0xff;
                    }
                    else
                    {
                        operands[12] &= 0xfc;
                    }
                }
                break;

            case BhavWizBhav.dataFormat.newFormat:
                for (int i = 0; i < 4; i++)
                {
                    BhavWiz.FromShort(ref operands, i * 3 + 1, aldoc[i].Value); operands[i * 3] = aldoc[i].DataOwner;
                }
                if (nodeVersion > 0)
                {
                    operands[12] &= 0xfc;
                }
                operands[12] |= 0x01;
                break;

            case BhavWizBhav.dataFormat.useParams:
                operands[12] &= 0xfe;
                operands[12] |= 0x02;
                break;
            }
        }
Ejemplo n.º 11
0
 void doid1_DataOwnerControlChanged(object sender, EventArgs e)
 {
     if (internalchg)
     {
         return;
     }
     if (doid1.DataOwner >= 0)
     {
         o5678[1] = doid1.DataOwner;
     }
     BhavWiz.FromShort(ref o5678, 2, doid1.Value);
 }
Ejemplo n.º 12
0
        public UI()
        {
            //
            // Erforderlich für die Windows Form-Designerunterstützung
            //
            InitializeComponent();

            cbOperator.Items.Clear();
            cbOperator.Items.AddRange(BhavWiz.readStr(GS.BhavStr.Operators).ToArray());

            labelledDataOwner2.Decimal           = labelledDataOwner1.Decimal = pjse.Settings.PJSE.DecimalDOValue;
            labelledDataOwner2.UseInstancePicker = labelledDataOwner1.UseInstancePicker = pjse.Settings.PJSE.InstancePickerAsText;
        }
Ejemplo n.º 13
0
 public LabelledDataOwner(BhavWiz inst, byte downer, ushort value)
 {
     InitializeComponent();
     doc = new pjse.BhavOperandWizards.DataOwnerControl(
         inst
         , cbDataOwner
         , cbPicker
         , tbVal
         , ckbDecimal
         , ckbUseInstancePicker
         , lbInstance
         , downer, value);
 }
Ejemplo n.º 14
0
        public UI()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.cbRTBNType.Items.Clear();
            this.cbRTBNType.Items.AddRange(BhavWiz.readStr(GS.BhavStr.RTBNType).ToArray());

            ldocArg3.Decimal           = ldocArg2.Decimal = ldocArg1.Decimal = pjse.Settings.PJSE.DecimalDOValue;
            ldocArg3.UseInstancePicker = ldocArg2.UseInstancePicker = ldocArg1.UseInstancePicker = pjse.Settings.PJSE.InstancePickerAsText;
        }
Ejemplo n.º 15
0
        public void Execute(Instruction inst)
        {
            byte operand0 = inst.Operands[0];

            this.cbGenericSimsCall.Items.Clear();
            for (byte i = 0; i < BhavWiz.readStr(GS.BhavStr.Generics).Count; i++)
            {
                this.cbGenericSimsCall.Items.Add("0x" + SimPe.Helper.HexString(i) + ": " + BhavWiz.readStr(GS.BhavStr.Generics, i));
            }
            this.lbGenericSimsCallparms.Text = "Should never see this";

            lbGenericSimsCallparms.Text     = genericSimsCallparamText(operand0);
            cbGenericSimsCall.SelectedIndex = (operand0 < cbGenericSimsCall.Items.Count) ? operand0 : -1;
        }
Ejemplo n.º 16
0
        public void Execute(Instruction inst)
        {
            this.inst = labelledDataOwner1.Instruction = labelledDataOwner2.Instruction = inst;

            wrappedByteArray ops = inst.Operands;

            labelledDataOwner1.Value     = BhavWiz.ToShort(ops[0x00], ops[0x01]);
            labelledDataOwner1.DataOwner = ops[0x06];

            cbOperator.SelectedIndex = (cbOperator.Items.Count > ops[0x05]) ? ops[0x05] : -1;

            labelledDataOwner2.Value     = BhavWiz.ToShort(ops[0x02], ops[0x03]);
            labelledDataOwner2.DataOwner = ops[0x07];
        }
Ejemplo n.º 17
0
        public UI()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.tbGUID.Visible     = false;
            this.tbGUID.Left        = this.cbToNext.Left + this.cbToNext.Width + 3;
            this.tbLocalVar.Visible = false;
            this.tbLocalVar.Left    = this.cbToNext.Left + this.cbToNext.Width + 3;

            this.cbToNext.Items.AddRange(BhavWiz.readStr(GS.BhavStr.NextObject).ToArray());
            this.cbWhere.Items.AddRange(BhavWiz.readStr(GS.BhavStr.DataLabels).ToArray());
        }
Ejemplo n.º 18
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops = inst.Operands;

                ops[0x06] = labelledDataOwner1.DataOwner;
                BhavWiz.FromShort(ref ops, 0, labelledDataOwner1.Value);

                ops[0x05] = (byte)cbOperator.SelectedIndex;

                ops[0x07] = labelledDataOwner2.DataOwner;
                BhavWiz.FromShort(ref ops, 2, labelledDataOwner2.Value);
            }
            return(inst);
        }
Ejemplo n.º 19
0
        private void doFormat()
        {
            byte[] o = operands; // lazy...
            pnWizBhav.SuspendLayout();
            ckbDecimal.Enabled           = format != BhavWizBhav.dataFormat.useTemps && format != BhavWizBhav.dataFormat.useParams;
            ckbUseInstancePicker.Enabled = format == BhavWizBhav.dataFormat.newFormat;

            for (int i = 0; i < aldoc.Length; i++)
            {
                aldoc[i].Enabled = (format != BhavWizBhav.dataFormat.useTemps && format != BhavWizBhav.dataFormat.useParams) &&
                                   !(format == BhavWizBhav.dataFormat.newFormat && i >= 4);
                aldoc[i].DataOwnerEnabled = format == BhavWizBhav.dataFormat.newFormat;
                switch (format)
                {
                case BhavWizBhav.dataFormat.useTemps:
                    aldoc[i].Value     = (ushort)i;
                    aldoc[i].DataOwner = 0x08;
                    break;

                case BhavWizBhav.dataFormat.useParams:
                    aldoc[i].Value     = (ushort)i;
                    aldoc[i].DataOwner = 0x09;
                    break;

                case BhavWizBhav.dataFormat.oldFormat:
                    aldoc[i].Value     = BhavWiz.ToShort(o[i * 2], o[i * 2 + 1]);
                    aldoc[i].DataOwner = 0x07;
                    break;

                case BhavWizBhav.dataFormat.newFormat:
                    if (i < 4)
                    {
                        aldoc[i].Value     = BhavWiz.ToShort(o[(i * 3) + 1], o[(i * 3) + 2]);
                        aldoc[i].DataOwner = o[i * 3];
                    }
                    else
                    {
                        aldoc[i].Value     = 0;
                        aldoc[i].DataOwner = 0x07;
                    }
                    break;
                }
            }
            pnWizBhav.ResumeLayout();
        }
Ejemplo n.º 20
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                BhavWiz.FromShort(ref ops1, 0, doid3.Value);

                ops1[0x02]  = 0x00;
                ops1[0x02] |= (byte)(this.rb3Object.Checked ? 0x01 : 0x00);
                switch (this.cbMatScope.SelectedIndex)
                {
                case 2: ops1[0x02] |= 0x02; break;     // Global

                case 1: ops1[0x02] |= 0x04; break;     // SemiGlobal
                }
                ops1[0x02] |= (byte)(this.rb1Object.Checked ? 0x08 : 0x00);
                ops1[0x02] |= (byte)(this.ckbMaterialTemp.Checked ? 0x10 : 0x00);
                ops1[0x02] |= (byte)(this.ckbMeshTemp.Checked ? 0x20 : 0x00);
                switch (this.cbMeshScope.SelectedIndex)
                {
                case 2: ops1[0x02] |= 0x40; break;     // Global

                case 1: ops1[0x02] |= 0x80; break;     // SemiGlobal
                }

                BhavWiz.FromShort(ref ops1, 3, (ushort)(doid5.Value & 0x7fff));
                ops1[0x04] |= (byte)(this.ckbAllOver.Checked ? 0x80 : 0x00);

                ops1[0x05] = doid1.DataOwner;
                BhavWiz.FromShort(ref ops1, 6, doid1.Value);

                ops2[0x00] = doid2.DataOwner;
                BhavWiz.FromShort(ref ops2, 1, doid2.Value);

                ops2[0x05] &= 0xfc;
                ops2[0x05] |= (byte)(this.rb2MovingTexture.Checked ? 0x01 : 0x00);
                ops2[0x05] |= (byte)(this.rb1ScrShot.Checked ? 0x02 : 0x00);
            }
            return(inst);
        }
Ejemplo n.º 21
0
        private void hex16_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (inst.NodeVersion < 2 && hex8_IsValid(sender))
            {
                return;
            }
            else if (hex16_IsValid(sender))
            {
                return;
            }

            e.Cancel = true;

            bool origstate = internalchg;

            internalchg            = true;
            ((TextBox)sender).Text = "0x" + SimPe.Helper.HexString(BhavWiz.ToShort(inst.Reserved1[0x03], inst.Reserved1[0x04]));
            ((TextBox)sender).SelectAll();
            internalchg = origstate;
        }
Ejemplo n.º 22
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            internalchg = true;

            setGUID(ops1, 0);

            doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbVal1, this.cbDecimal, this.cbAttrPicker, null,
                                         ops1[0x06], BhavWiz.ToShort(ops1[0x04], ops1[0x05]));

            Boolset ops1_7 = ops1[0x07];

            this.ckbOrigGUID.Checked = ops1_7[0];
            this.ckbNID.Checked      = ops1_7[1];
            this.ckbTemp01.Checked   = ops1_7[2];

            internalchg = false;
        }
Ejemplo n.º 23
0
        public Instruction Execute(BhavWiz i, int wizType)
        {
            pjse.ABhavOperandWiz wiz = null;
            switch (wizType)
            {
            case 0: wiz = new pjse.BhavOperandWizards.BhavOperandWizRaw(i); break;

            case 1: wiz = i.Wizard(); break;

            default: wiz = new pjse.BhavOperandWizards.BhavOperandWizDefault(i); break;
            }
            if (wiz == null)
            {
                return(null);
            }

            Panel pn = wiz.bhavPrimWizPanel;

            pn.Parent   = this;
            pn.Top      = 0;
            pn.Left     = 0;
            pn.TabIndex = 1;
            pn_Resize(pn, null);
            pn.Resize += new EventHandler(pn_Resize);
            wiz.Execute();

            DialogResult dr = ShowDialog();

            Close();

            switch (dr)
            {
            case DialogResult.OK:
                return(wiz.Write());

            default:
                return(null);
            }
        }
Ejemplo n.º 24
0
        public void Execute(Instruction inst)
        {
            this.inst = ldocArg1.Instruction = ldocArg2.Instruction = ldocArg3.Instruction = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            internalchg = true;

            Boolset options = (byte)(ops1[0x02] & 0x3f);

            this.cbScope.SelectedIndex = 0; // Private
            if (options[0])
            {
                this.cbScope.SelectedIndex = 2;                  // Global
            }
            else if (options[1])
            {
                this.cbScope.SelectedIndex = 1;                  // SemiGlobal
            }
            this.tfSemiGlobal.Checked = !options[3];
            this.tfGlobal.Checked     = !options[2];

            this.cbRTBNType.SelectedIndex = ops1[0x05] < this.cbRTBNType.Items.Count ? ops1[0x05] : -1;

            this.flpArgs.Enabled  = this.tfArgs.Checked = options[4];
            this.tfParams.Checked = options[5];

            doidTree = new DataOwnerControl(null, null, null, this.tbTree, null, null, null, 0x07, BhavWiz.ToShort(ops1[0x04], (byte)((ops1[0x02] >> 6) & 0x01)));
            doidTree.DataOwnerControlChanged += new EventHandler(doidTree_DataOwnerControlChanged);
            doidTree_DataOwnerControlChanged(null, null);

            ldocArg1.Value = BhavWiz.ToShort(ops1[0x07], ops2[0x00]); ldocArg1.DataOwner = ops1[0x06];
            ldocArg2.Value = BhavWiz.ToShort(ops2[0x02], ops2[0x03]); ldocArg2.DataOwner = ops2[0x01];
            ldocArg3.Value = BhavWiz.ToShort(ops2[0x05], ops2[0x06]); ldocArg3.DataOwner = ops2[0x04];

            internalchg = false;
        }
Ejemplo n.º 25
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            byte[] o = new byte[16];
            ((byte[])inst.Operands).CopyTo(o, 0);
            ((byte[])inst.Reserved1).CopyTo(o, 8);

            setOperation(o[0x01]);
            // See discussion around whether this is a bit vs boolean:
            // http://simlogical.com/SMF/index.php?topic=917.msg6641#msg6641
            rb1StackObj.Checked = !(rb1My.Checked = (o[0x2] == 0));

            doidArray = new DataOwnerControl(inst, null, this.cbObjectArray, this.tbObjectArray,
                                             this.ckbDecimal, this.ckbAttrPicker, null,
                                             0x29, BhavWiz.ToShort(o[0x03], o[0x04]));
            doidValue = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbval1,
                                             this.ckbDecimal, this.ckbAttrPicker, this.lbConst1,
                                             o[0x05], BhavWiz.ToShort(o[0x06], o[0x07]));
            doidIndex = new DataOwnerControl(inst, this.cbDataOwner2, this.cbPicker2, this.tbval2,
                                             this.ckbDecimal, this.ckbAttrPicker, this.lbConst2,
                                             o[0x08], BhavWiz.ToShort(o[0x09], o[0x0a]));
        }
Ejemplo n.º 26
0
        private void hex16_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (inst.NodeVersion < 2 && hex8_IsValid(sender))
            {
                return;
            }
            else if (hex16_IsValid(sender))
            {
                return;
            }

            e.Cancel = true;

            bool origstate = internalchg;

            internalchg = true;
            ushort val = inst.NodeVersion < 2 ? inst.Operands[0x04] : BhavWiz.ToShort(inst.Reserved1[0x06], inst.Reserved1[0x07]);

            this.lbActionString.Text = ((BhavWiz)inst).readStr(this.Scope, GS.GlobalStr.MakeAction, (ushort)(val - 1), -1, pjse.Detail.ErrorNames);
            ((TextBox)sender).Text   = "0x" + SimPe.Helper.HexString(val);
            ((TextBox)sender).SelectAll();
            internalchg = origstate;
        }
Ejemplo n.º 27
0
        public Instruction Write(Instruction inst)
        {
            if (inst != null)
            {
                wrappedByteArray ops1 = inst.Operands;
                wrappedByteArray ops2 = inst.Reserved1;

                if (cbOperation.SelectedIndex >= 0)
                {
                    ops1[0x01] = (byte)cbOperation.SelectedIndex;
                }
                ops1[0x02] = (byte)(rb1My.Checked ? 0x00 : 0x02); // Not sure why "0x02" at the game treats as 0 / !0

                BhavWiz.FromShort(ref ops1, 3, doidArray.Value);

                ops1[0x05] = doidValue.DataOwner;
                BhavWiz.FromShort(ref ops1, 6, doidValue.Value);

                ops2[0x00] = doidIndex.DataOwner;
                BhavWiz.FromShort(ref ops2, 1, doidIndex.Value);
            }
            return(inst);
        }
Ejemplo n.º 28
0
        public void Execute(Instruction inst)
        {
            this.inst = inst;

            wrappedByteArray ops1 = inst.Operands;
            wrappedByteArray ops2 = inst.Reserved1;

            internalchg = true;

            setGUID(ops1, 0);

            this.cbToNext.SelectedIndex = -1;
            setToNext((byte)(ops1[4] & 0x7f));

            this.ckbStackObj.Checked = (ops1[4] & 0x80) == 0;
            this.pnObject.Enabled    = !this.ckbStackObj.Checked;

            doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbVal1, this.cbDecimal, this.cbAttrPicker, null,
                                         ops1[0x05], ops1[0x07]);

            this.tbLocalVar.Text = "0x" + SimPe.Helper.HexString(ops1[0x06]);

            this.pnNodeVersion.Enabled = (inst.NodeVersion != 0);
            this.ckbDisabled.Checked   = (ops2[0x00] & 0x01) != 0;
            this.pnWhere.Enabled       = this.ckbWhere.Checked = (ops2[0x00] & 0x02) != 0;

            ushort where = BhavWiz.ToShort(ops2[0x01], ops2[0x02]);
            this.cbWhere.SelectedIndex = -1;
            if (this.cbWhere.Items.Count > where)
            {
                this.cbWhere.SelectedIndex = where;
            }
            this.tbWhereVal.Text = "0x" + SimPe.Helper.HexString(BhavWiz.ToShort(ops2[0x03], ops2[0x04]));

            internalchg = false;
        }
Ejemplo n.º 29
0
        private void SetDataOwner()
        {
            if (internalchg)
            {
                return;
            }

            internalchg = true;

            if (cbDataOwner != null && cbDataOwner.SelectedIndex != dataOwner)
            {
                dataOwner = (byte)cbDataOwner.SelectedIndex;
                setTextBoxLength();
                tbValue.Text = tbValueConverter(instance);
                OnDataOwnerControlChanged(this, new EventArgs());
            }

            #region pickerNames
            List <String> pickerNames = null;
            if (useInstancePicker && cbPicker != null)
            {
                if (useFlagNames && dataOwner == 0x07 && flagsFor != null)
                {
                    pickerNames = BhavWiz.flagNames(flagsFor.DataOwner, flagsFor.Value);
                    if (pickerNames != null)
                    {
                        pickerNames = new List <string>(pickerNames);
                        pickerNames.Insert(0, "[0: " + pjse.Localization.GetString("invalid") + "]");
                    }
                }
                else if (inst != null && useInstancePicker && (dataOwner == 0x00 || dataOwner == 0x01))
                {
                    pickerNames = inst.GetAttrNames(Scope.Private);
                }
                else if (inst != null && useInstancePicker && (dataOwner == 0x02 || dataOwner == 0x05))
                {
                    pickerNames = inst.GetAttrNames(Scope.SemiGlobal);
                }
                else if (inst != null && dataOwner == 0x09 || dataOwner == 0x16 || dataOwner == 0x32) // Param
                {
                    pickerNames = inst.GetTPRPnames(false);
                }
                else if (inst != null && dataOwner == 0x19) // Local
                {
                    pickerNames = inst.GetTPRPnames(true);
                }
                else if (inst != null && useInstancePicker && (dataOwner >= 0x29 && dataOwner <= 0x2F))
                {
                    pickerNames = inst.GetArrayNames();
                }
                else if (BhavWiz.doidGStr[dataOwner] != null)
                {
                    pickerNames = BhavWiz.readStr((GS.BhavStr)BhavWiz.doidGStr[dataOwner]);
                }
            }
            #endregion


            if (pickerNames != null && pickerNames.Count > 0)
            {
                if (tbValue != null)
                {
                    tbValue.TabStop = tbValue.Visible = false;
                }
                cbPicker.TabStop = cbPicker.Visible = true;
                cbPicker.Items.Clear();
                cbPicker.Items.AddRange(pickerNames.ToArray());
                cbPicker.SelectedIndex = (cbPicker.Items.Count > instance) ? instance : -1;
            }
            else
            {
                if (cbPicker != null)
                {
                    cbPicker.TabStop = cbPicker.Visible = false;
                }
                if (tbValue != null)
                {
                    tbValue.TabStop = tbValue.Visible = true;
                }
            }

            setInstanceLabel();

            internalchg = false;
        }
Ejemplo n.º 30
0
        public void SetDataOwnerControl(BhavWiz inst, ComboBox cbDataOwner, ComboBox cbPicker, TextBox tbValue,
                                        CheckBox ckbDecimal, CheckBox ckbUseInstancePicker, Label lbInstance, byte dataOwner, ushort instance)
        {
            this.Dispose();
            this.inst                 = inst;
            this.cbDataOwner          = cbDataOwner;
            this.cbPicker             = cbPicker;
            this.tbValue              = tbValue;
            this.ckbDecimal           = ckbDecimal;
            this.ckbUseInstancePicker = ckbUseInstancePicker;
            this.lbInstance           = lbInstance;
            this.dataOwner            = dataOwner;
            this.instance             = instance;

            this.flagsFor = null;

            internalchg = true;
            if (this.cbDataOwner != null)
            {
                this.cbDataOwner.Items.Clear();
                this.cbDataOwner.Items.AddRange(BhavWiz.readStr(GS.BhavStr.DataOwners).ToArray());
                if (cbDataOwner.Items.Count > dataOwner)
                {
                    cbDataOwner.SelectedIndex = dataOwner;
                }
                this.cbDataOwner.SelectedIndexChanged += new System.EventHandler(this.cbDataOwner_SelectedIndexChanged);
            }

            if (this.cbPicker != null)
            {
                this.cbPicker.SelectedIndexChanged += new System.EventHandler(this.cbPicker_SelectedIndexChanged);
            }

            if (this.tbValue != null)
            {
                this.tbValue.Text         = this.tbValueConverter(instance);
                this.tbValue.Validating  += new System.ComponentModel.CancelEventHandler(this.tbValue_Validating);
                this.tbValue.Validated   += new System.EventHandler(this.tbValue_Validated);
                this.tbValue.TextChanged += new System.EventHandler(this.tbValue_TextChanged);
                this.tbValue.Enter       += new System.EventHandler(this.tbValue_Enter);
            }

            pjse.Settings.PJSE.DecimalDOValueChanged += new EventHandler(PJSE_DecimalDOValueChanged);
            Decimal = pjse.Settings.PJSE.DecimalDOValue;
            if (this.ckbDecimal != null)
            {
                this.ckbDecimal.Checked         = Decimal;
                this.ckbDecimal.CheckedChanged += new System.EventHandler(this.ckbDecimal_CheckedChanged);
            }

            pjse.Settings.PJSE.InstancePickerAsTextChanged += new EventHandler(PJSE_InstancePickerAsTextChanged);
            UseInstancePicker = pjse.Settings.PJSE.InstancePickerAsText;
            if (this.ckbUseInstancePicker != null)
            {
                this.ckbUseInstancePicker.Checked         = UseInstancePicker;
                this.ckbUseInstancePicker.CheckedChanged += new System.EventHandler(this.ckbUseAttrPicker_CheckedChanged);
            }

            internalchg = false;

            SetDataOwner();

            setTextBoxLength();
            setInstanceLabel();
        }