Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions STROOP/Tabs/GhostTab/GhostTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,14 @@ public override void Update(bool active)
(var frame, var animation) = ghost.lastValidPlaybackFrame;
animation = animation == 0 ? (uint)frame.animationIndex : animation;

Array.Copy(BitConverter.GetBytes(frame.position.X), 0, buffer, i * 0x20 + 0x00, 4);
Array.Copy(BitConverter.GetBytes(frame.position.Y), 0, buffer, i * 0x20 + 0x04, 4);
Array.Copy(BitConverter.GetBytes(frame.position.Z), 0, buffer, i * 0x20 + 0x08, 4);
const short FAR = 30_000;
var position = ghost.frames.ContainsKey((uint)(globalTimer - ghost.playbackBaseFrame - 1))
? frame.position
: new Vector3(FAR, FAR, FAR);

Array.Copy(BitConverter.GetBytes(position.X), 0, buffer, i * 0x20 + 0x00, 4);
Array.Copy(BitConverter.GetBytes(position.Y), 0, buffer, i * 0x20 + 0x04, 4);
Array.Copy(BitConverter.GetBytes(position.Z), 0, buffer, i * 0x20 + 0x08, 4);
Array.Copy(BitConverter.GetBytes(ghost.nonMarioGraphics != 0 ? animation : frame.animationIndex), 0, buffer, i * 0x20 + 0x0C, 4);
Array.Copy(BitConverter.GetBytes(frame.oPitch), 0, buffer, i * 0x20 + 0x12, 2);
Array.Copy(BitConverter.GetBytes(frame.oYaw), 0, buffer, i * 0x20 + 0x10, 2);
Expand Down Expand Up @@ -209,9 +214,7 @@ public override void Update(bool active)

IEnumerable<Ghost> GetSelectedGhosts()
{
var lst = listBoxGhosts.SelectedItems.ConvertAndRemoveNull(_ => _ as Ghost);
lst.Sort((a, b) => a.transparent && !b.transparent ? 1 : (a.transparent == b.transparent ? 0 : -1));
return lst;
return listBoxGhosts.SelectedItems.OfType<Ghost>();
}

void AddGhost(string name, Ghost newGhost)
Expand Down
Loading