diff --git a/MarathonRecomp/api/Marathon.h b/MarathonRecomp/api/Marathon.h index ebdf1f76..c494b62d 100644 --- a/MarathonRecomp/api/Marathon.h +++ b/MarathonRecomp/api/Marathon.h @@ -52,6 +52,7 @@ #include "Sonicteam/SoX/Engine/Doc.h" #include "Sonicteam/SoX/Engine/DocMode.h" #include "Sonicteam/SoX/Engine/Task.h" +#include "Sonicteam/SoX/Math/Vector.h" #include "Sonicteam/SoX/MessageReceiver.h" #include "Sonicteam/SoX/Object.h" #include "Sonicteam/TitleTask.h" diff --git a/MarathonRecomp/api/Sonicteam/SoX/Math/Vector.h b/MarathonRecomp/api/Sonicteam/SoX/Math/Vector.h new file mode 100644 index 00000000..eb55c149 --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SoX/Math/Vector.h @@ -0,0 +1,31 @@ +#pragma once + +#include "Marathon.inl" + +namespace Sonicteam::SoX::Math +{ + class Vector2 + { + public: + be X; + be Y; + }; + + class Vector + { + public: + be X; + be Y; + be Z; + be W; + }; + + class Vector4 + { + public: + be X; + be Y; + be Z; + be W; + }; +} \ No newline at end of file diff --git a/MarathonRecomp/patches/misc_patches.cpp b/MarathonRecomp/patches/misc_patches.cpp index 0d8c515d..c9d20f0d 100644 --- a/MarathonRecomp/patches/misc_patches.cpp +++ b/MarathonRecomp/patches/misc_patches.cpp @@ -102,3 +102,25 @@ bool DisableHints() { return !Config::Hints; } + +// Change Y position in Shadow Sonicteam::Player::Object to move it closer to the glider's Y position +PPC_FUNC_IMPL(__imp__sub_8219FAE0); +PPC_FUNC(sub_8219FAE0) +{ + struct OBJPlayerSpawnData + { + public: + xpointer PlayerName; + MARATHON_INSERT_PADDING(0x2C); + Sonicteam::SoX::Math::Vector4 PlayerPosition; + MARATHON_INSERT_PADDING(0xC); + }; + + auto pSpawnData = reinterpret_cast(base + ctx.r4.u32); + if (strcmp("shadow_glider.lua", pSpawnData->PlayerName.get()) == 0 && pSpawnData->PlayerPosition.Y.get() == 5626.4f) + { + pSpawnData->PlayerPosition.Y = 5608; + } + + __imp__sub_8219FAE0(ctx, base); +}