Skip to content

Commit

Permalink
GspVertexCommand: property I
Browse files Browse the repository at this point in the history
  • Loading branch information
akopetsch committed Jul 6, 2024
1 parent 6004c60 commit e5a3596
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6b87f9ab1fbc7b7cf5080bb23b79cd85bb357188 AssetsDb.sqlite
8fb9e41abc26f4782ac285fd7025c3912ef03ea1 AssetsDb.sqlite
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class DbGspVertexCommand : DbBlockItemStructure<GspVertexCommand>
{
#region Properties

public int I { get; set; }
public int N { get; set; }
public byte V0PlusN { get; set; }
public int P_V { get; set; }
public int V0 { get; set; }

#endregion

Expand All @@ -26,9 +26,9 @@ public override void CopyFrom(Node node)

var x = (GspVertexCommand)node.Value;

I = x.I;
N = x.N;
V0PlusN = x.V0PlusN;
P_V = GetValuePosition(node.Graph, x.V.Value);
V0 = x.V0;
}

public override bool Equals(DbBlockItemStructure<GspVertexCommand> other)
Expand All @@ -38,9 +38,9 @@ public override bool Equals(DbBlockItemStructure<GspVertexCommand> other)
if (!base.Equals(x))
return false;

if (I != x.I) return false;
if (N != x.N) return false;
if (V0PlusN != x.V0PlusN) return false;
if (P_V != x.P_V) return false;
if (V0 != x.V0) return false;

return true;
}
Expand All @@ -55,7 +55,7 @@ public override bool Equals(object obj)

public override int GetHashCode() =>
CombineHashCodes(base.GetHashCode(),
N, V0PlusN, P_V);
I, N, V0);

#endregion
}
Expand Down
10 changes: 8 additions & 2 deletions src/SWE1R.Assets.Blocks/ModelBlock/F3DEX2/GspVertexCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public class GspVertexCommand : GraphicsCommand

#region Properties (C macro)

public int I
{
get => V.Index ?? -1;
set => V.Index = value;
}

public byte N
{
get => Convert.ToByte(NPadded >> NPadding);
Expand Down Expand Up @@ -88,15 +94,15 @@ public GspVertexCommand() :
base(GraphicsCommandByte.G_VTX)
{ }

public GspVertexCommand(IList<Vtx> vertices, int verticesStartIndex, int n, int v0PlusN) :
public GspVertexCommand(IList<Vtx> vertices, int i, int n, int v0PlusN) :
this() // TODO: mimick C macro
{
N = Convert.ToByte(n);
V0PlusN = Convert.ToByte(v0PlusN);
V = new ReferenceByIndex<Vtx>()
{
Collection = vertices,
Index = verticesStartIndex,
Index = i,
};
}

Expand Down

0 comments on commit e5a3596

Please sign in to comment.