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 = 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]; }
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(); }
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; }
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; }
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; }
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])); }
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; 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; }
private void refreshDoid1() { tbVal1.Text = "0x" + SimPe.Helper.HexString(BhavWiz.ToShort(o5678[2], o5678[3])); cbDataOwner1.SelectedIndex = (cbDataOwner1.Items.Count > o5678[1]) ? o5678[1] : -1; }
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 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; } }