Skip to content

Commit 7ee42ea

Browse files
committed
Anchor - Fix crash with Dark Link
1 parent 7022eca commit 7ee42ea

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

soh/soh/Network/Anchor/DummyPlayer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ void DummyPlayer_Init(Actor* actor, PlayState* play) {
7070
Player_SetModelGroup(player, Player_ActionToModelGroup(player, player->heldItemAction));
7171
play->playerInit(player, play, gPlayerSkelHeaders[client.linkAge]);
7272

73+
// playerInit grabs one of the 25 blure slots for the sword trail, but we never
74+
// draw trails for other players. Free it so a busy lobby doesn't use up every slot
75+
// (which makes all weapon trails vanish and crashes the Dark Link fight).
76+
Effect_Delete(play, player->meleeWeaponEffectIndex);
77+
// mark as not held
78+
player->meleeWeaponEffectIndex = TOTAL_EFFECT_COUNT;
79+
7380
play->func_11D54(player, play);
7481
// #endregion
7582

@@ -243,6 +250,11 @@ void DummyPlayer_Draw(Actor* actor, PlayState* play) {
243250
}
244251

245252
void DummyPlayer_Destroy(Actor* actor, PlayState* play) {
253+
Player* player = (Player*)actor;
254+
255+
// Free the sword trail slot like Player_Destroy does (no-op if Init already freed it).
256+
Effect_Delete(play, player->meleeWeaponEffectIndex);
257+
246258
// DummyPlayer Actors are initially spawned as ACTOR_PLAYER, but change their
247259
// ID shortly afterwards to ACTOR_EN_OE2. This would cause ACTOR_PLAYER's
248260
// ActorDB Entry's `numLoaded` to leak, which is mostly harmless but hits debug

0 commit comments

Comments
 (0)