summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinspectredc <78732756+inspectredc@users.noreply.github.com>2024-06-10 05:09:36 +0100
committerGitHub <noreply@github.com>2024-06-09 22:09:36 -0600
commitdd5d75e2b93d4d2266ed47ee859392f55f6dbe25 (patch)
tree90e5ce63ad5adfb5bef6f37da28bbf4e4f7a1995
parent97b2fb2291bc25e79fa92e9242ae2e6be52a50bf (diff)
Fix Preset and Yaw in Macro Factory (#130)
* Fix Preset and Yaw in Macro Factory * remove leftover macro
-rw-r--r--src/factories/sm64/MacroFactory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/factories/sm64/MacroFactory.cpp b/src/factories/sm64/MacroFactory.cpp
index a3e5feb..b7ff67d 100644
--- a/src/factories/sm64/MacroFactory.cpp
+++ b/src/factories/sm64/MacroFactory.cpp
@@ -36,7 +36,7 @@ ExportResult SM64::MacroCodeExporter::Export(std::ostream &write, std::shared_pt
}
write << object.preset << ", ";
- write << object.yaw << ", ";
+ write << "CONVERT_YAW(" << object.yaw << "), ";
write << object.posX << ", ";
write << object.posY << ", ";
write << object.posZ;
@@ -89,8 +89,9 @@ std::optional<std::shared_ptr<IParsedData>> SM64::MacroFactory::parse(std::vecto
break;
}
- int16_t yaw = ((presetYaw >> 9) * 45) / 0x10;
- int16_t preset = (presetYaw - ((yaw * 0x10 / 45) << 9)) - 0x1F;
+ int16_t yaw = ((presetYaw >> 9) & 0x7F) << 1;
+ int16_t preset = (presetYaw & 0x1FF) - 0x1F;
+
auto posX = reader.ReadInt16();
auto posY = reader.ReadInt16();
auto posZ = reader.ReadInt16();