mirror of https://github.com/zeldaret/mm.git
carry flag (#1725)
This commit is contained in:
parent
ea323f1712
commit
13c42b487d
|
@ -503,8 +503,9 @@ typedef enum DoorLockType {
|
|||
#define ACTOR_FLAG_200000 (1 << 21)
|
||||
//
|
||||
#define ACTOR_FLAG_400000 (1 << 22)
|
||||
//
|
||||
#define ACTOR_FLAG_800000 (1 << 23)
|
||||
// When Player is carrying this actor, it can only be thrown, not dropped/placed.
|
||||
// Typically an actor can only be thrown when moving, but this allows an actor to be thrown when standing still.
|
||||
#define ACTOR_FLAG_THROW_ONLY (1 << 23)
|
||||
//
|
||||
#define ACTOR_FLAG_1000000 (1 << 24)
|
||||
// Actor can update even if Player is currently using the ocarina.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "attributes.h"
|
||||
#include "overlays/actors/ovl_En_Aob_01/z_en_aob_01.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((EnDg*)thisx)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "assets/objects/object_ishi/object_ishi.h"
|
||||
#include "overlays/actors/ovl_En_Insect/z_en_insect.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((EnIshi*)thisx)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
#include "overlays/actors/ovl_En_Insect/z_en_insect.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((EnKusa*)thisx)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((EnKusa2*)thisx)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "z_en_niw.h"
|
||||
#include "overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((EnNiw*)thisx)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "overlays/actors/ovl_Obj_Grass/z_obj_grass.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((ObjGrassCarry*)thisx)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "z_obj_snowball2.h"
|
||||
#include "assets/objects/object_goroiwa/object_goroiwa.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_800000)
|
||||
#define FLAGS (ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
#define THIS ((ObjSnowball2*)thisx)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "assets/objects/object_tsubo/object_tsubo.h"
|
||||
#include "assets/objects/object_racetsubo/object_racetsubo.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000 | ACTOR_FLAG_CAN_PRESS_SWITCH)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_THROW_ONLY | ACTOR_FLAG_CAN_PRESS_SWITCH)
|
||||
|
||||
#define THIS ((ObjTsubo*)thisx)
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ s32 Player_UpperAction_6(Player* this, PlayState* play);
|
|||
s32 Player_UpperAction_7(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_8(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_9(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_10(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_CarryActor(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_11(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_12(Player* this, PlayState* play);
|
||||
s32 Player_UpperAction_13(Player* this, PlayState* play);
|
||||
|
@ -3137,9 +3137,9 @@ PlayerUpperActionFunc sPlayerUpperActionUpdateFuncs[PLAYER_IA_MAX] = {
|
|||
Player_UpperAction_6, // PLAYER_IA_BOW_ICE
|
||||
Player_UpperAction_6, // PLAYER_IA_BOW_LIGHT
|
||||
Player_UpperAction_6, // PLAYER_IA_HOOKSHOT
|
||||
Player_UpperAction_10, // PLAYER_IA_BOMB
|
||||
Player_UpperAction_10, // PLAYER_IA_POWDER_KEG
|
||||
Player_UpperAction_10, // PLAYER_IA_BOMBCHU
|
||||
Player_UpperAction_CarryActor, // PLAYER_IA_BOMB
|
||||
Player_UpperAction_CarryActor, // PLAYER_IA_POWDER_KEG
|
||||
Player_UpperAction_CarryActor, // PLAYER_IA_BOMBCHU
|
||||
Player_UpperAction_11, // PLAYER_IA_11
|
||||
Player_UpperAction_6, // PLAYER_IA_DEKU_NUT
|
||||
Player_UpperAction_0, // PLAYER_IA_PICTOGRAPH_BOX
|
||||
|
@ -4344,7 +4344,7 @@ bool func_808313A8(PlayState* play, Player* this, Actor* actor) {
|
|||
|
||||
void func_808313F0(Player* this, PlayState* play) {
|
||||
if (!func_808313A8(play, this, this->heldActor)) {
|
||||
Player_SetUpperAction(play, this, Player_UpperAction_10);
|
||||
Player_SetUpperAction(play, this, Player_UpperAction_CarryActor);
|
||||
PlayerAnimation_PlayLoop(play, &this->skelAnimeUpper, &gPlayerAnim_link_normal_carryB_wait);
|
||||
}
|
||||
}
|
||||
|
@ -9417,12 +9417,21 @@ void func_8083D6DC(Player* this, PlayState* play) {
|
|||
Player_Anim_PlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_throw][this->modelAnimType]);
|
||||
}
|
||||
|
||||
// Determines whether a held actor should be dropped or thrown: false implies droppable.
|
||||
s32 func_8083D738(Player* this, Actor* heldActor) {
|
||||
if ((heldActor != NULL) && !(heldActor->flags & ACTOR_FLAG_800000) &&
|
||||
/**
|
||||
* 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* heldActor) {
|
||||
// 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 ((heldActor != NULL) && !(heldActor->flags & ACTOR_FLAG_THROW_ONLY) &&
|
||||
((this->speedXZ < 1.1f) || (heldActor->id == ACTOR_EN_BOM_CHU))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9431,7 +9440,7 @@ s32 Player_ActionHandler_9(Player* this, PlayState* play) {
|
|||
if ((this->heldActor != NULL) &&
|
||||
CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_B | BTN_A)) {
|
||||
if (!func_808313A8(play, this, this->heldActor)) {
|
||||
if (!func_8083D738(this, this->heldActor)) {
|
||||
if (!Player_CanThrowCarriedActor(this, this->heldActor)) {
|
||||
Player_SetAction(play, this, Player_Action_41, 1);
|
||||
Player_Anim_PlayOnce(play, this, D_8085BE84[PLAYER_ANIMGROUP_put][this->modelAnimType]);
|
||||
return true;
|
||||
|
@ -11349,7 +11358,7 @@ void Player_SetDoAction(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_8083D738(this, heldActor)) {
|
||||
if (!Player_CanThrowCarriedActor(this, heldActor)) {
|
||||
doActionA = DO_ACTION_DROP;
|
||||
} else {
|
||||
doActionA = DO_ACTION_THROW;
|
||||
|
@ -13796,7 +13805,7 @@ s32 Player_UpperAction_9(Player* this, PlayState* play) {
|
|||
return true;
|
||||
}
|
||||
|
||||
s32 Player_UpperAction_10(Player* this, PlayState* play) {
|
||||
s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) {
|
||||
Actor* heldActor = this->heldActor;
|
||||
|
||||
if (heldActor == NULL) {
|
||||
|
|
|
@ -4536,7 +4536,7 @@
|
|||
0x8083D168:("func_8083D168",),
|
||||
0x8083D23C:("Player_ActionHandler_2",),
|
||||
0x8083D6DC:("func_8083D6DC",),
|
||||
0x8083D738:("func_8083D738",),
|
||||
0x8083D738:("Player_CanThrowCarriedActor",),
|
||||
0x8083D78C:("Player_ActionHandler_9",),
|
||||
0x8083D860:("func_8083D860",),
|
||||
0x8083DCC4:("func_8083DCC4",),
|
||||
|
@ -4654,7 +4654,7 @@
|
|||
0x80848BF4:("Player_UpperAction_7",),
|
||||
0x80848E4C:("Player_UpperAction_8",),
|
||||
0x80849054:("Player_UpperAction_9",),
|
||||
0x808490B4:("Player_UpperAction_10",),
|
||||
0x808490B4:("Player_UpperAction_CarryActor",),
|
||||
0x808491B4:("Player_UpperAction_11",),
|
||||
0x8084923C:("Player_UpperAction_12",),
|
||||
0x808492C4:("Player_UpperAction_13",),
|
||||
|
|
Loading…
Reference in New Issue