mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-29 00:06:33 +00:00
Document ACTOR_FLAG_THROW_ONLY
(#2274)
* document ACTOR_FLAG_THROW_ONLY * flip function name * add comments
This commit is contained in:
parent
a53fb02699
commit
df1815cf8f
6 changed files with 22 additions and 12 deletions
|
@ -184,8 +184,9 @@ typedef struct ActorShape {
|
|||
// ignores point lights but not directional lights (such as environment lights)
|
||||
#define ACTOR_FLAG_IGNORE_POINT_LIGHTS (1 << 22)
|
||||
|
||||
//
|
||||
#define ACTOR_FLAG_23 (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_24 (1 << 24)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "quake.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_23
|
||||
#define FLAGS ACTOR_FLAG_THROW_ONLY
|
||||
|
||||
void EnIshi_Init(Actor* thisx, PlayState* play);
|
||||
void EnIshi_Destroy(Actor* thisx, PlayState* play2);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "assets/objects/object_kusa/object_kusa.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
void EnKusa_Init(Actor* thisx, PlayState* play);
|
||||
void EnKusa_Destroy(Actor* thisx, PlayState* play2);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "terminal.h"
|
||||
#include "versions.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
void EnNiw_Init(Actor* thisx, PlayState* play);
|
||||
void EnNiw_Destroy(Actor* thisx, PlayState* play);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
|
||||
#include "assets/objects/object_tsubo/object_tsubo.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23)
|
||||
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_THROW_ONLY)
|
||||
|
||||
void ObjTsubo_Init(Actor* thisx, PlayState* play);
|
||||
void ObjTsubo_Destroy(Actor* thisx, PlayState* play2);
|
||||
|
|
|
@ -7423,20 +7423,29 @@ 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_23) &&
|
||||
/**
|
||||
* 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) && !(actor->flags & ACTOR_FLAG_THROW_ONLY) &&
|
||||
((this->speedXZ < 1.1f) || (actor->id == ACTOR_EN_BOM_CHU))) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 Player_ActionHandler_9(Player* this, PlayState* play) {
|
||||
if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor != NULL) &&
|
||||
CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) {
|
||||
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 {
|
||||
|
@ -10897,7 +10906,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;
|
||||
|
|
Loading…
Reference in a new issue