mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-21 23:01:26 -04:00
Enhancement, drop throw-only actors toggle (#7023)
Co-authored-by: djevangelia <djevangelia>
This commit is contained in:
@@ -7461,13 +7461,23 @@ void func_8083EA94(Player* this, PlayState* play) {
|
||||
Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_throw, this->modelAnimType));
|
||||
}
|
||||
|
||||
s32 func_8083EAF0(Player* this, Actor* actor) {
|
||||
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_THROW_ONLY) &&
|
||||
/**
|
||||
* Checks if an actor can be thrown or dropped.
|
||||
* It is assumed that the `actor` argument is the actor currently being carried.
|
||||
*
|
||||
* @return true if it can be thrown, false if it can be dropped.
|
||||
*/
|
||||
s32 Player_CanThrowCarriedActor(Player* this, Actor* actor) {
|
||||
// If the actor arg is null, true will be returned.
|
||||
// It doesn't make sense for a non-existent actor to be thrown or dropped, so
|
||||
// the safety check should happen before this function is even called.
|
||||
if ((actor != NULL) &&
|
||||
GameInteractor_Should(VB_ON_ACTOR_THROW_ONLY_CHECK, !(actor->flags & ACTOR_FLAG_THROW_ONLY), actor) &&
|
||||
((this->linearVelocity < 1.1f) || (actor->id == ACTOR_EN_BOM_CHU))) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 Player_ActionHandler_9(Player* this, PlayState* play) {
|
||||
@@ -7480,17 +7490,17 @@ s32 Player_ActionHandler_9(Player* this, PlayState* play) {
|
||||
CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)),
|
||||
sControlInput)) {
|
||||
if (!func_80835644(play, this, this->heldActor)) {
|
||||
if (!func_8083EAF0(this, this->heldActor)) {
|
||||
if (!Player_CanThrowCarriedActor(this, this->heldActor)) {
|
||||
Player_SetupAction(play, this, Player_Action_808464B0, 1);
|
||||
Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_put, this->modelAnimType));
|
||||
} else {
|
||||
func_8083EA94(this, play);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
|
||||
@@ -11037,7 +11047,7 @@ void Player_UpdateInterface(PlayState* play, Player* this) {
|
||||
} else if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->getItemId == GI_NONE) &&
|
||||
(heldActor != NULL)) {
|
||||
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (heldActor->id == ACTOR_EN_NIW)) {
|
||||
if (func_8083EAF0(this, heldActor) == 0) {
|
||||
if (!Player_CanThrowCarriedActor(this, heldActor)) {
|
||||
doAction = DO_ACTION_DROP;
|
||||
} else {
|
||||
doAction = DO_ACTION_THROW;
|
||||
|
||||
Reference in New Issue
Block a user