From 7e9b0d2e96d2d6f28cc4a83b0735a3c7e7dbdd13 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Tue, 26 Nov 2024 00:39:47 +0000 Subject: [PATCH] Fix change suit primitive editor Not fantastic, but it works. --- .../Primitives/ChangeSuitDescriptor.cs | 6 ++- .../ResourceEditors/TTABResourceControl.cs | 2 +- .../Primitives/VMChangeSuitOrAccessory.cs | 39 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/TSOClient/FSO.IDE/EditorComponent/Primitives/ChangeSuitDescriptor.cs b/TSOClient/FSO.IDE/EditorComponent/Primitives/ChangeSuitDescriptor.cs index f93498096..ad7daeba2 100644 --- a/TSOClient/FSO.IDE/EditorComponent/Primitives/ChangeSuitDescriptor.cs +++ b/TSOClient/FSO.IDE/EditorComponent/Primitives/ChangeSuitDescriptor.cs @@ -32,7 +32,11 @@ public override void PopulateOperandView(BHAVEditor master, EditorScope escope, panel.Controls.Add(new OpLabelControl(master, escope, Operand, new OpStaticTextProvider("Changes the Caller's suit to the specified. Can change outfits and add accessories."))); panel.Controls.Add(new OpValueControl(master, escope, Operand, "Suit Data: ", "SuitData", new OpStaticValueBoundsProvider(0, 255))); panel.Controls.Add(new OpComboControl(master, escope, Operand, "Suit Scope:", "SuitScope", new OpStaticNamedPropertyProvider(EditorScope.Behaviour.Get(227)))); - panel.Controls.Add(new OpComboControl(master, escope, Operand, "Suit Op:", "Flags", new OpStaticNamedPropertyProvider(EditorScope.Behaviour.Get(228)))); + panel.Controls.Add(new OpFlagsControl(master, escope, Operand, "Suit Op:", new OpFlag[] { + new OpFlag("Remove Accessory", "Remove"), + new OpFlag("Use Temp", "UseTemp"), + new OpFlag("Update Outfit", "Update"), + })); } } } diff --git a/TSOClient/FSO.IDE/ResourceBrowser/ResourceEditors/TTABResourceControl.cs b/TSOClient/FSO.IDE/ResourceBrowser/ResourceEditors/TTABResourceControl.cs index e5a6cdfb4..447530422 100644 --- a/TSOClient/FSO.IDE/ResourceBrowser/ResourceEditors/TTABResourceControl.cs +++ b/TSOClient/FSO.IDE/ResourceBrowser/ResourceEditors/TTABResourceControl.cs @@ -177,7 +177,7 @@ public void SetActiveResource(IffChunk chunk, GameIffResource res) public BHAV GetBHAV(ushort id) { - if (id >= 8192 && Object != null) return Object.Resource.SemiGlobal.Get(id); //semiglobal + if (id >= 8192 && Object != null) return Object.Resource.SemiGlobal?.Get(id); //semiglobal else if (id >= 4096) return Resource.Get(id); //private else return EditorScope.Globals.Resource.Get(id); //global } diff --git a/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs b/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs index 8b814e155..a8182444e 100644 --- a/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs +++ b/TSOClient/tso.simantics/Primitives/VMChangeSuitOrAccessory.cs @@ -164,6 +164,45 @@ public class VMChangeSuitOrAccessoryOperand : VMPrimitiveOperand { public VMSuitScope SuitScope { get; set; } public VMChangeSuitOrAccessoryFlags Flags { get; set; } + public bool Remove + { + get + { + return (Flags & VMChangeSuitOrAccessoryFlags.Remove) > 0; + } + set + { + if (value) Flags |= VMChangeSuitOrAccessoryFlags.Remove; + else Flags &= ~VMChangeSuitOrAccessoryFlags.Remove; + } + } + + public bool UseTemp + { + get + { + return (Flags & VMChangeSuitOrAccessoryFlags.UseTemp) > 0; + } + set + { + if (value) Flags |= VMChangeSuitOrAccessoryFlags.UseTemp; + else Flags &= ~VMChangeSuitOrAccessoryFlags.UseTemp; + } + } + + public bool Update + { + get + { + return (Flags & VMChangeSuitOrAccessoryFlags.Update) > 0; + } + set + { + if (value) Flags |= VMChangeSuitOrAccessoryFlags.Update; + else Flags &= ~VMChangeSuitOrAccessoryFlags.Update; + } + } + #region VMPrimitiveOperand Members public void Read(byte[] bytes) {