Adjust Actor_GetProjectileActor to behave more like hardware, fixing an issue with Dark Link (#4606)

This commit is contained in:
Garrett Cox 2024-12-02 13:40:29 -06:00 committed by GitHub
parent caf0dc40c7
commit fe9bf7d956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@
#include "vt.h"
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#include "overlays/actors/ovl_En_Part/z_en_part.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
@ -3854,8 +3855,14 @@ Actor* Actor_GetProjectileActor(PlayState* play, Actor* refActor, f32 radius) {
// it can also be an arrow.
// Luckily, the field at the same offset in the arrow actor is the x component of a vector
// which will rarely ever be 0. So it's very unlikely for this bug to cause an issue.
//
// SoH [Port] We're making a change here, it doesn't technically fix the bug but makes it behave
// more like hardware. Because of pointer size differences in SoH this was accessing a different
// place in memory and causing issues with Dark link behavior, and probably other places too
if ((Math_Vec3f_DistXYZ(&refActor->world.pos, &actor->world.pos) > radius) ||
(((ArmsHook*)actor)->timer == 0)) {
(actor->id == ACTOR_ARMS_HOOK && ((ArmsHook*)actor)->timer == 0) ||
(actor->id == ACTOR_EN_ARROW && ((EnArrow*)actor)->unk_210.x == 0)
) {
actor = actor->next;
} else {
deltaX = Math_SinS(actor->world.rot.y) * (actor->speedXZ * 10.0f);