From ea1553c18db572b9642bfcda153a3fb1c5542324 Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 6 Oct 2020 23:38:56 -0700 Subject: [PATCH] Koopa shell can only be ridden by one person, and doesn't get accidentally removed --- src/game/interaction.c | 6 +++++- src/game/mario_actions_airborne.c | 2 +- src/game/mario_actions_submerged.c | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/game/interaction.c b/src/game/interaction.c index d0d14fbc8..0b43bcb1d 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -293,7 +293,7 @@ u32 attack_object(struct Object *o, s32 interaction) { } void mario_stop_riding_object(struct MarioState *m) { - if (m->riddenObj != NULL) { + if (m->riddenObj != NULL && m->playerIndex == 0) { m->riddenObj->oInteractStatus = INT_STATUS_STOP_RIDING; if (m->playerIndex == 0) { stop_shell_music(); } m->riddenObj = NULL; @@ -1699,6 +1699,10 @@ u32 interact_breakable(struct MarioState *m, UNUSED u32 interactType, struct Obj } u32 interact_koopa_shell(struct MarioState *m, UNUSED u32 interactType, struct Object *o) { + if (o->oInteractStatus & INT_STATUS_INTERACTED) { + return FALSE; + } + if (!(m->action & ACT_FLAG_RIDING_SHELL)) { u32 interaction = determine_interaction(m, o); diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index c205b12be..4b08813ca 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -1070,7 +1070,7 @@ s32 act_crazy_box_bounce(struct MarioState *m) { if (m->actionArg < 2) { set_mario_action(m, ACT_CRAZY_BOX_BOUNCE, m->actionArg + 1); } else { - if (m->heldObj != NULL) { + if (m->heldObj != NULL && m->playerIndex == 0) { m->heldObj->oInteractStatus = INT_STATUS_STOP_RIDING; m->heldObj = NULL; } diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 0534fa790..e4b46d20d 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -750,7 +750,7 @@ static s32 act_water_shell_swimming(struct MarioState *m) { } if (m->actionTimer++ == 240) { - if (m->heldObj != NULL) { + if (m->heldObj != NULL && m->playerIndex == 0) { m->heldObj->oInteractStatus = INT_STATUS_STOP_RIDING; m->heldObj = NULL; } @@ -1503,10 +1503,10 @@ static s32 check_common_submerged_cancels(struct MarioState *m) { // where your held object is the shell, but you are not in the // water shell swimming action. This allows you to hold the water // shell on land (used for cloning in DDD). - if (m->action == ACT_WATER_SHELL_SWIMMING && m->heldObj != NULL) { + if (m->action == ACT_WATER_SHELL_SWIMMING && m->heldObj != NULL && m->playerIndex == 0) { m->heldObj->oInteractStatus = INT_STATUS_STOP_RIDING; m->heldObj = NULL; - if (m->playerIndex == 0) { stop_shell_music(); } + stop_shell_music(); } return transition_submerged_to_walking(m);