while (true) do
HorizontalSpeed = memory.readfloat(0x33B1C4, true);
VerticalSpeed = memory.readfloat(0x33B1BC, true);
XSpeed = memory.readfloat(0x33B1C0, true); -- 0x33B1CC
YSpeed = memory.readfloat(0x33B1B8, true); -- 0x33B1C8
XYSpeed = math.sqrt(XSpeed^2+YSpeed^2);
XPosition = memory.readfloat(0x33B1B4, true); -- 0x33C52C, 0x33C5DC
YPosition = memory.readfloat(0x33B1AC, true); -- 0x33C524, 0x33C5D4
ZPosition = memory.readfloat(0x33B1B0, true); -- 0x33C528, 0x33C5D8
MovementAngle = memory.read_u16_be(0x33B194);
FacingAngle = memory.read_u16_be(0x33B19E); -- 0x33C532, (0x33B1A8 only updates on ground)
gui.drawRectangle(2, 38, 145, 84, 0x00000000, 0x77000000);
gui.text(8, 80, "H Speed: "..HorizontalSpeed);
gui.text(8, 95, "X Speed: "..XSpeed);
gui.text(8, 110, "Y Speed: "..YSpeed);
gui.text(8, 125, "XY Speed: "..XYSpeed);
gui.text(8, 145, "V Speed: "..VerticalSpeed);
gui.text(8, 165, "M Angle: "..MovementAngle);
gui.text(8, 180, "F Angle: "..FacingAngle);
gui.text(8, 195, "X Position: "..XPosition);
gui.text(8, 210, "Y Position: "..YPosition);
gui.text(8, 225, "Z Position: "..ZPosition);
gui.drawRectangle(149, 9, 163, 163, 0x00000000, 0x77000000);
gui.drawLine(150, 90, 310, 90);
gui.drawPixel(309, 89);
gui.drawPixel(309, 91);
gui.drawPixel(151, 89);
gui.drawPixel(151, 91);
gui.text(625, 173, "X");
gui.drawLine(230, 170, 230, 10);
gui.drawPixel(229, 11);
gui.drawPixel(231, 11);
gui.drawPixel(229, 169);
gui.drawPixel(231, 169);
gui.text(455, 2, "Y");
gui.drawLine(230, 90, 230+XSpeed*1.5, 90-YSpeed*1.5, 0xFFFF0000);
gui.text(215, 2, "XY Speed", 0xFF000000, 0xFFFF0000);
XCoordMAngle = math.cos(MovementAngle*math.pi/32768)*75;
YCoordMAngle = math.sin(MovementAngle*math.pi/32768)*75;
gui.drawLine(230, 90, 230+XCoordMAngle, 90-YCoordMAngle, 0xFF00FF00);
gui.text(300, 2, "M Angle", 0xFF000000, 0xFF00FF00);
XCoordFAngle = math.cos(FacingAngle*math.pi/32768)*75;
YCoordFAngle = math.sin(FacingAngle*math.pi/32768)*75;
gui.drawLine(230, 90, 230+XCoordFAngle, 90-YCoordFAngle, 0xFF0000FF);
gui.text(375, 2, "F Angle", 0xFF000000, 0xFF0000FF);
emu.frameadvance();
end;