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); ops1[0x06] = doid1.DataOwner; ops1[0x04] = (byte)(doid1.Value & 0xff); ops1[0x05] = (byte)(doid1.Value >> 8 & 0xff); Boolset ops1_7 = ops1[0x07]; ops1_7[0] = this.ckbOrigGUID.Checked; ops1_7[1] = this.ckbNID.Checked; ops1_7[2] = this.ckbTemp01.Checked; ops1[0x07] = ops1_7; } return(inst); }
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); }
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); }
public Instruction Write(Instruction inst) { if (inst != null) { wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; Boolset ops14 = ops1[4]; ops1[0] = (byte)doid1.Value; ops1[1] = (byte)(doid1.Value >> 8); if (cbSlotType.SelectedIndex >= 1) { ops1[2] = (byte)(cbSlotType.SelectedIndex - 1); ops1[3] = (byte)((cbSlotType.SelectedIndex - 1) >> 8); } ops14[0] = ckbNFailTrees.Checked; ops14[1] = (cbSlotType.SelectedIndex == 0); ops14[2] = ckbIgnDstFootprint.Checked; ops14[3] = ckbDiffAlts.Checked; ops1[4] = ops14; } return(inst); }
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); }
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; }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops = inst.Operands; doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbval1, this.cbDecimal, this.cbAttrPicker, this.lbConst1, ops[0x02], (ushort)((ops[0x01] << 8) | ops[0x00])); doid2 = new DataOwnerControl(inst, this.cbDataOwner2, this.cbPicker2, this.tbval2, this.cbDecimal, this.cbAttrPicker, this.lbConst2, ops[0x06], (ushort)((ops[0x05] << 8) | ops[0x04])); }
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]; }
public Instruction Write(Instruction inst) { if (inst != null) { wrappedByteArray ops = inst.Operands; ops[0x02] = doid1.DataOwner; ops[0x00] = (byte)(doid1.Value & 0xff); ops[0x01] = (byte)((doid1.Value >> 8) & 0xff); ops[0x06] = doid2.DataOwner; ops[0x04] = (byte)(doid2.Value & 0xff); ops[0x05] = (byte)((doid2.Value >> 8) & 0xff); } return inst; }
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); }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; Boolset ops16 = ops1[6]; //internalchg = true; cbLocation.SelectedIndex = ((byte)(ops1[2] + 2) < cbLocation.Items.Count) ? (byte)(ops1[2] + 2) : -1; cbDirection.SelectedIndex = ((byte)(ops1[3] + 2) < cbDirection.Items.Count) ? (byte)(ops1[3] + 2) : -1; ckbNoFailureTrees.Checked = ops16[1]; ckbDifferentAltitudes.Checked = ops16[2]; //internalchg = false; }
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); }
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; }
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; }
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); }
public Instruction Write(Instruction inst) { if (inst != null) { wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; Boolset ops16 = ops1[6]; if (cbLocation.SelectedIndex >= 0) { ops1[2] = ((byte)(cbLocation.SelectedIndex - 2)); } if (cbDirection.SelectedIndex >= 0) { ops1[3] = ((byte)(cbDirection.SelectedIndex - 2)); } ops16[1] = ckbNoFailureTrees.Checked; ops16[2] = ckbDifferentAltitudes.Checked; ops1[6] = ops16; } return(inst); }
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; }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; Boolset options1 = null; Boolset options2 = null; int scope = 0; int priority = -1; internalchg = true; foreach (CheckBox c in lckb) { c.Visible = false; } doidAnim = new DataOwnerControl(inst, null, null, tbValAnim, ckbDecimal, ckbAttrPicker, null, 0x07, BhavWiz.ToShort(ops1[0], ops1[1])); doidAnim.DataOwnerControlChanged += new EventHandler(doidAnim_DataOwnerControlChanged); options1 = ops1[2]; doidEvent = new DataOwnerControl(inst, null, null, tbValEventTree, ckbDecimal, ckbAttrPicker, null, 0x07, BhavWiz.ToShort(ops1[4], ops1[5])); doidEvent.DataOwnerControlChanged += new EventHandler(doidEvent_DataOwnerControlChanged); switch (mode) { case "bwp_Object": doidObject = new DataOwnerControl(inst, cbdoObject, cbPickerObject, tbValObject, ckbDecimal, ckbAttrPicker, null, ops1[6], BhavWiz.ToShort(ops1[7], ops2[0])); scope = ops2[1]; options2 = ops2[2]; break; case "bwp_Sim": doidAnimType = new DataOwnerControl(inst, null, null, tbValAnimType, ckbDecimal, ckbAttrPicker, null, 0x07, (byte)ops1[6]); doidAnimType.DataOwnerControlChanged += new EventHandler(doidAnimType_DataOwnerControlChanged); scope = ops1[7]; options2 = ops2[0]; doidIK = new DataOwnerControl(inst, cbdoIK, cbPickerIK, tbValIK, ckbDecimal, ckbAttrPicker, null, ops2[1], BhavWiz.ToShort(ops2[2], ops2[3])); priority = ops2[4]; break; case "bwp_Overlay": doidObject = new DataOwnerControl(inst, cbdoObject, cbPickerObject, tbValObject, ckbDecimal, ckbAttrPicker, null, ops1[6], BhavWiz.ToShort(ops1[7], ops2[0])); doidAnimType = new DataOwnerControl(inst, null, null, tbValAnimType, ckbDecimal, ckbAttrPicker, null, 0x07, (byte)ops2[1]); doidAnimType.DataOwnerControlChanged += new EventHandler(doidAnimType_DataOwnerControlChanged); if (inst.NodeVersion != 0) { priority = ops2[3]; ckbNotHurryable.Checked = (ops2[4] & 0x01) != 0; ckbNotHurryable.Visible = true; } else { priority = ops2[4]; } scope = ops2[6]; options2 = ops2[7]; break; } for (int i = 0; i < lckbOptions1.Count; i++) { if (lckbOptions1[i] != null) { lckbOptions1[i].Visible = true; lckbOptions1[i].Checked = options1[i]; } } for (int i = 0; i < lckbOptions2.Count; i++) { if (lckbOptions2[i] != null) { lckbOptions2[i].Visible = true; lckbOptions2[i].Checked = options2[i]; } } switch (scope) { case 0: cbEventScope.SelectedIndex = 0; break; case 1: cbEventScope.SelectedIndex = 1; break; default: cbEventScope.SelectedIndex = 2; break; } internalchg = false; if (!mode.Equals("bwp_Object")) { doidAnimType_DataOwnerControlChanged(null, null); } else { doidAnim_DataOwnerControlChanged(null, null); } doidEvent_DataOwnerControlChanged(null, null); ckbParam_CheckedChanged(null, null); ckbFlipTemp3_CheckedChanged(null, null); if (priority < cbPriority.Items.Count) { cbPriority.SelectedIndex = priority; } }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; internalchg = true; doid3 = new DataOwnerControl(inst, null, null, this.tbVal3, this.cbDecimal, this.cbAttrPicker, null, 0x07, BhavWiz.ToShort(ops1[0x00], ops1[0x01])); this.rb3Object.Checked = ((ops1[0x02] & 0x01) != 0); this.btnMesh.Visible = this.tbMesh.Visible = this.rb3Me.Checked = !this.rb3Object.Checked; this.cbMatScope.SelectedIndex = -1; switch (ops1[0x02] & 0x06) { case 0x00: this.cbMatScope.SelectedIndex = 0; break; // Private case 0x02: this.cbMatScope.SelectedIndex = 2; break; // Global case 0x04: this.cbMatScope.SelectedIndex = 1; break; // SemiGlobal } this.rb1ScrShot.Checked = ((ops2[0x05] & 0x02) != 0); this.rb1Me.Checked = !this.rb1ScrShot.Checked && ((ops1[0x02] & 0x08) == 0); this.rb1Object.Checked = !this.rb1ScrShot.Checked && !this.rb1Me.Checked; this.rb2MovingTexture.Checked = ((ops2[0x05] & 0x01) != 0); this.rb2Material.Checked = !this.rb2MovingTexture.Checked; this.ckbMaterialTemp.Checked = ((ops1[0x02] & 0x10) != 0); this.ckbMeshTemp.Checked = ((ops1[0x02] & 0x20) != 0); this.cbMeshScope.SelectedIndex = -1; switch (ops1[0x02] & 0xc0) { case 0x00: this.cbMeshScope.SelectedIndex = 0; break; // Private case 0x40: this.cbMeshScope.SelectedIndex = 2; break; // Global case 0x80: this.cbMeshScope.SelectedIndex = 1; break; // SemiGlobal } doid5 = new DataOwnerControl(inst, null, null, this.tbVal5, this.cbDecimal, this.cbAttrPicker, null, 0x07, (ushort)(BhavWiz.ToShort(ops1[0x03], ops1[0x04]) & 0x7fff)); this.ckbAllOver.Checked = (ops1[0x04] & 0x80) != 0; doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbVal1, this.cbDecimal, this.cbAttrPicker, null, ops1[0x05], BhavWiz.ToShort(ops1[0x06], ops1[0x07])); doid2 = new DataOwnerControl(inst, this.cbDataOwner2, this.cbPicker2, this.tbVal2, this.cbDecimal, this.cbAttrPicker, null, ops2[0x00], BhavWiz.ToShort(ops2[0x01], ops2[0x02])); doid3.DataOwnerControlChanged += new EventHandler(doid3_DataOwnerControlChanged); doid3_DataOwnerControlChanged(null, null); doid5.DataOwnerControlChanged += new EventHandler(doid5_DataOwnerControlChanged); doid5_DataOwnerControlChanged(null, null); internalchg = false; this.MaterialFrom(); this.MeshFrom(); }
public Instruction Write(Instruction inst) { if (inst != null) { wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; if (this.rbModeAction.Checked) { ops2[0x01] = 0; if (this.cbScope.SelectedIndex >= 0) { ops1[0x02] &= 0xf3; if (this.cbScope.SelectedIndex == 2) { ops1[0x02] |= 0x04; } if (this.cbScope.SelectedIndex == 1) { ops1[0x02] |= 0x08; } } ops1[0x02] &= 0xef; if (this.tfActionTemp.Checked) { ops1[0x02] |= 0x10; } else { ushort val = Convert.ToUInt16(this.tbStrIndex.Text, 16); if (inst.NodeVersion < 2) { ops1[0x04] = (byte)(val & 0xff); } else { BhavWiz.FromShort(ref ops2, 6, val); } } if (inst.NodeVersion != 0 && this.cbDisabled.SelectedIndex != -1) { ops1[0x03] &= 0xfc; if (this.cbDisabled.SelectedIndex == 0) { ops1[0x03] |= 0x01; } else if (this.cbDisabled.SelectedIndex == 1) { ops1[0x03] |= 0x02; } } if (inst.NodeVersion > 2) { ops1[0x03] &= 0xef; if (this.tfSubQ.Checked) { ops1[0x03] |= 0x10; } } } else { if (ops2[0x01] == 0) { ops2[0x01] = 1; } ops1[0x02] &= 0x7f; if (this.tfIconTemp.Checked) { ops1[0x02] |= 0x80; } else { ops2[0x03] = Convert.ToByte(this.tbIconIndex.Text, 16); } ops1[0x02] &= 0xdf; if (this.pnThumbnail.Enabled) { ops1[0x02] |= 0x20; ops1[0x02] &= 0xbf; if (this.tfGUIDTemp.Checked) { ops1[0x02] |= 0x40; } else { uint val = Convert.ToUInt32(this.tbGUID.Text, 16); ops1[0x05] = (byte)(val & 0xff); ops1[0x06] = (byte)((val >> 8) & 0xff); ops1[0x07] = (byte)((val >> 16) & 0xff); ops2[0x00] = (byte)((val >> 24) & 0xff); } } else { ops2[0x03] = doid1.DataOwner; BhavWiz.FromShort(ref ops2, 4, doid1.Value); } } } return(inst); }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; internalchg = true; this.lbDisabled.Enabled = this.cbDisabled.Enabled = inst.NodeVersion != 0; this.tfSubQ.Enabled = inst.NodeVersion > 2; this.cbScope.SelectedIndex = -1; switch (ops1[0x02] & 0x0c) { case 0x00: this.cbScope.SelectedIndex = 0; break; // Private case 0x04: this.cbScope.SelectedIndex = 2; break; // Global case 0x08: this.cbScope.SelectedIndex = 1; break; // SemiGlobal } this.tfActionTemp.Checked = (ops1[0x02] & 0x10) != 0; this.pnStrIndex.Enabled = !this.tfActionTemp.Checked; this.pnThumbnail.Enabled = this.rbIconSourceTN.Checked = ((ops1[0x02] & 0x20) != 0); this.pnObject.Enabled = this.rbIconSourceObj.Checked = !this.rbIconSourceTN.Checked; this.tfGUIDTemp.Checked = ((ops1[0x02] & 0x40) != 0); this.pnGUID.Enabled = !this.tfGUIDTemp.Checked; this.tfIconTemp.Checked = (ops1[0x02] & 0x80) != 0; this.pnIconIndex.Enabled = !this.tfIconTemp.Checked; this.cbDisabled.SelectedIndex = -1; switch (ops1[0x03] & 0x03) { case 0x00: this.cbDisabled.SelectedIndex = 2; break; case 0x01: this.cbDisabled.SelectedIndex = 0; break; case 0x02: this.cbDisabled.SelectedIndex = 1; break; } this.tfSubQ.Checked = (ops1[0x03] & 0x10) != 0; int val = inst.NodeVersion < 2 ? ops1[0x04] : BhavWiz.ToShort(ops2[0x06], ops2[0x07]); this.tbStrIndex.Text = "0x" + SimPe.Helper.HexString((ushort)val); this.lbActionString.Text = ((BhavWiz)inst).readStr(this.Scope, GS.GlobalStr.MakeAction, (ushort)(val - 1), -1, pjse.Detail.ErrorNames); this.tbGUID.Text = "0x" + SimPe.Helper.HexString(ops1[0x05] | (ops1[0x06] << 8) | (ops1[0x07] << 16) | (ops2[0x00] << 24)); this.pnAction.Enabled = this.rbModeAction.Checked = ops2[0x01] == 0; this.pnIcon.Enabled = this.rbModeIcon.Checked = !this.rbModeAction.Checked; this.tbIconIndex.Text = "0x" + SimPe.Helper.HexString(ops2[0x03]); doid1 = new DataOwnerControl(inst, this.cbDataOwner1, this.cbPicker1, this.tbVal1, this.cbDecimal, this.cbAttrPicker, null, ops2[0x03], BhavWiz.ToShort(ops2[0x04], ops2[0x05])); internalchg = false; }
public void Execute(Instruction inst) { this.inst = inst; wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; o5678[0] = ops1[5]; o5678[1] = ops1[6]; o5678[2] = ops1[7]; o5678[3] = ops2[0]; internalchg = true; Boolset option1 = ops1[0]; if (inst.NodeVersion < 1) { // In the parser we have something like this... //option1 = (inst.NodeVersion >= 1) ? ops1[0] : (byte)(((ops1[0] & 0x3C) << 1) | (ops1[0] & 0x83)); // 8765 4321 // 0065 4300 <<1 = // 0654 3000 | // 8000 0021 = // 8654 3021 List <String> aS = new List <string>(aInventoryType.ToArray()); aS.RemoveRange(4, aS.Count - 4); cbTargetInv.Items.Clear(); cbTargetInv.Items.AddRange(aS.ToArray()); cbInventory.Items.Clear(); cbInventory.Items.AddRange(aS.ToArray()); cbTargetInv.SelectedIndex = ((option1 & 0x03) < cbTargetInv.Items.Count) ? option1 & 0x03 : -1; rb1Counted.Checked = option1[2]; ckbTTInvVisible.Checked = !option1[3]; ckbTTInvMemory.Checked = !option1[4]; } else { cbTargetInv.Items.Clear(); cbTargetInv.Items.AddRange(aInventoryType.ToArray()); cbInventory.Items.Clear(); cbInventory.Items.AddRange(aInventoryType.ToArray()); cbTargetInv.SelectedIndex = ((option1 & 0x07) < cbTargetInv.Items.Count) ? option1 & 0x07 : -1; rb1Counted.Checked = option1[3]; ckbTTInvVisible.Checked = !option1[4]; ckbTTInvMemory.Checked = !option1[5]; } ckbReversed.Checked = option1[7]; pnDoid0.Enabled = (cbTargetInv.SelectedIndex >= 1 && cbTargetInv.SelectedIndex <= 3); lbDoid0.Text = pnDoid0.Enabled ? cbTargetInv.SelectedItem.ToString() : ""; rb1Singular.Checked = !rb1Counted.Checked; doid0 = new DataOwnerControl(inst, cbDataOwner0, cbPicker0, tbVal0, ckbDecimal, ckbAttrPicker, null, ops1[1], BhavWiz.ToShort(ops1[2], ops1[3])); operation = ops1[4]; doid1 = new DataOwnerControl(inst, cbDataOwner1, cbPicker1, tbVal1, ckbDecimal, ckbAttrPicker, null, o5678[1], BhavWiz.ToShort(o5678[2], o5678[3])); doid1.DataOwnerControlChanged += new EventHandler(doid1_DataOwnerControlChanged); ckbTTVisible.Enabled = ckbTTMemory.Enabled = ckbTTShopping.Enabled = (inst.NodeVersion >= 2); if (inst.NodeVersion >= 2) { Boolset option2 = ops2[1]; ckbTTInvShopping.Checked = !option2[0]; ckbTTVisible.Checked = option2[2]; ckbTTMemory.Checked = option2[3]; ckbTTShopping.Checked = option2[5]; } doid2 = new DataOwnerControl(inst, cbDataOwner2, cbPicker2, tbVal2, ckbDecimal, ckbAttrPicker, null, ops2[2], BhavWiz.ToShort(ops2[3], ops2[4])); doid3 = new DataOwnerControl(inst, cbDataOwner3, cbPicker3, tbVal3, ckbDecimal, ckbAttrPicker, null, ops2[5], BhavWiz.ToShort(ops2[6], ops2[7])); if (rb1Counted.Checked) { doCounted(); } else { doSingular(); } cbOperation.SelectedIndex = (operation < cbOperation.Items.Count) ? operation : -1; internalchg = false; }
public Instruction Write(Instruction inst) { if (inst != null) { wrappedByteArray ops1 = inst.Operands; wrappedByteArray ops2 = inst.Reserved1; Boolset option1 = ops1[0]; if (inst.NodeVersion < 1) { if (cbTargetInv.SelectedIndex >= 0) { option1 = (byte)((option1 & 0xfc) | (cbTargetInv.SelectedIndex & 0x03)); } option1[2] = rb1Counted.Checked; option1[3] = !ckbTTInvVisible.Checked; option1[4] = !ckbTTInvMemory.Checked; } else { if (cbTargetInv.SelectedIndex >= 0) { option1 = (byte)((option1 & 0xf8) | (cbTargetInv.SelectedIndex & 0x07)); } option1[3] = rb1Counted.Checked; option1[4] = !ckbTTInvVisible.Checked; option1[5] = !ckbTTInvMemory.Checked; } option1[7] = ckbReversed.Checked; ops1[0] = option1; ops1[1] = doid0.DataOwner; BhavWiz.FromShort(ref ops1, 2, doid0.Value); ops1[4] = operation; ops1[5] = o5678[0]; ops1[6] = o5678[1]; ops1[7] = o5678[2]; ops2[0] = o5678[3]; if (inst.NodeVersion >= 2) { Boolset option2 = ops2[1]; option2[0] = !ckbTTInvShopping.Checked; option2[2] = ckbTTVisible.Checked; option2[3] = ckbTTMemory.Checked; option2[5] = ckbTTShopping.Checked; ops2[1] = option2; } ops2[2] = doid2.DataOwner; BhavWiz.FromShort(ref ops2, 3, doid2.Value); ops2[5] = doid3.DataOwner; BhavWiz.FromShort(ref ops2, 6, doid3.Value); } return(inst); }