Set minimal model set Id values to 0 for a bunch of meta edits

This commit is contained in:
Ottermandias 2022-08-15 12:58:14 +02:00
parent df9f791395
commit 6773fe0932
3 changed files with 9 additions and 11 deletions

View file

@ -47,7 +47,6 @@ public sealed unsafe class ExpandedEqdpFile : MetaBaseFile
throw new IndexOutOfRangeException(); throw new IndexOutOfRangeException();
} }
var x = new ReadOnlySpan< ushort >( ( ushort* )Data, Length / 2 );
return ( EqdpEntry )( *( ushort* )( Data + DataOffset + EqdpEntrySize * idx ) ); return ( EqdpEntry )( *( ushort* )( Data + DataOffset + EqdpEntrySize * idx ) );
} }
set set

View file

@ -67,7 +67,6 @@ public unsafe class ImcFile : MetaBaseFile
public readonly Utf8GamePath Path; public readonly Utf8GamePath Path;
public readonly int NumParts; public readonly int NumParts;
public bool ChangesSinceLoad = true;
public ReadOnlySpan< ImcEntry > Span public ReadOnlySpan< ImcEntry > Span
=> new(( ImcEntry* )( Data + PreambleSize ), ( Length - PreambleSize ) / sizeof( ImcEntry )); => new(( ImcEntry* )( Data + PreambleSize ), ( Length - PreambleSize ) / sizeof( ImcEntry ));

View file

@ -114,7 +114,7 @@ public partial class ModEditWindow
// Identifier // Identifier
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##eqpId", IdWidth, _new.SetId, out var setId, ExpandedEqpGmpBase.Count - 1 ) ) if( IdInput( "##eqpId", IdWidth, _new.SetId, out var setId, 1, ExpandedEqpGmpBase.Count - 1 ) )
{ {
_new = _new with { SetId = setId }; _new = _new with { SetId = setId };
} }
@ -209,7 +209,7 @@ public partial class ModEditWindow
// Identifier // Identifier
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##eqdpId", IdWidth, _new.SetId, out var setId, ExpandedEqpGmpBase.Count - 1 ) ) if( IdInput( "##eqdpId", IdWidth, _new.SetId, out var setId, 0, ExpandedEqpGmpBase.Count - 1 ) )
{ {
_new = _new with { SetId = setId }; _new = _new with { SetId = setId };
} }
@ -337,7 +337,7 @@ public partial class ModEditWindow
ImGuiUtil.HoverTooltip( "Object Type" ); ImGuiUtil.HoverTooltip( "Object Type" );
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##imcId", IdWidth, _new.PrimaryId, out var setId, ushort.MaxValue ) ) if( IdInput( "##imcId", IdWidth, _new.PrimaryId, out var setId, 0, ushort.MaxValue ) )
{ {
_new = _new with { PrimaryId = setId }; _new = _new with { PrimaryId = setId };
} }
@ -360,7 +360,7 @@ public partial class ModEditWindow
} }
else else
{ {
if( IdInput( "##imcId2", 100 * ImGuiHelpers.GlobalScale, _new.SecondaryId, out var setId2, ushort.MaxValue ) ) if( IdInput( "##imcId2", 100 * ImGuiHelpers.GlobalScale, _new.SecondaryId, out var setId2, 0, ushort.MaxValue ) )
{ {
_new = _new with { SecondaryId = setId2 }; _new = _new with { SecondaryId = setId2 };
} }
@ -369,7 +369,7 @@ public partial class ModEditWindow
} }
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##imcVariant", SmallIdWidth, _new.Variant, out var variant, byte.MaxValue ) ) if( IdInput( "##imcVariant", SmallIdWidth, _new.Variant, out var variant, 0, byte.MaxValue ) )
{ {
_new = _new with { Variant = variant }; _new = _new with { Variant = variant };
} }
@ -518,7 +518,7 @@ public partial class ModEditWindow
// Identifier // Identifier
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##estId", IdWidth, _new.SetId, out var setId, ExpandedEqpGmpBase.Count - 1 ) ) if( IdInput( "##estId", IdWidth, _new.SetId, out var setId, 0, ExpandedEqpGmpBase.Count - 1 ) )
{ {
_new = _new with { SetId = setId }; _new = _new with { SetId = setId };
} }
@ -616,7 +616,7 @@ public partial class ModEditWindow
// Identifier // Identifier
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if( IdInput( "##gmpId", IdWidth, _new.SetId, out var setId, ExpandedEqpGmpBase.Count - 1 ) ) if( IdInput( "##gmpId", IdWidth, _new.SetId, out var setId, 1, ExpandedEqpGmpBase.Count - 1 ) )
{ {
_new = _new with { SetId = setId }; _new = _new with { SetId = setId };
} }
@ -810,13 +810,13 @@ public partial class ModEditWindow
// A number input for ids with a optional max id of given width. // A number input for ids with a optional max id of given width.
// Returns true if newId changed against currentId. // Returns true if newId changed against currentId.
private static bool IdInput( string label, float width, ushort currentId, out ushort newId, int maxId ) private static bool IdInput( string label, float width, ushort currentId, out ushort newId, int minId, int maxId )
{ {
int tmp = currentId; int tmp = currentId;
ImGui.SetNextItemWidth( width ); ImGui.SetNextItemWidth( width );
if( ImGui.InputInt( label, ref tmp, 0 ) ) if( ImGui.InputInt( label, ref tmp, 0 ) )
{ {
tmp = Math.Clamp( tmp, 1, maxId ); tmp = Math.Clamp( tmp, minId, maxId );
} }
newId = ( ushort )tmp; newId = ( ushort )tmp;