Skip to content

Commit

Permalink
Adjust Actor_GetProjectileActor to behave more like hardware, fixing …
Browse files Browse the repository at this point in the history
…an issue with Dark Link
  • Loading branch information
garrettjoecox committed Dec 2, 2024
1 parent 9b74a09 commit 759b48c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion soh/src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 759b48c

Please sign in to comment.