Skip to content

Commit

Permalink
Name PLAYER_STATE1_ACTOR_CARRY (#2173)
Browse files Browse the repository at this point in the history
* actor carry flag

* format and add comments

* comment changes
  • Loading branch information
fig02 authored Sep 8, 2024
1 parent c7ec814 commit 900c2f0
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 65 deletions.
10 changes: 5 additions & 5 deletions include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,17 +649,17 @@ typedef struct WeaponInfo {
#define LEDGE_DIST_MAX 399.96002f

#define PLAYER_STATE1_0 (1 << 0)
#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1)
#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1) // Bottle is swung; Bottle is active and can catch things
#define PLAYER_STATE1_2 (1 << 2)
#define PLAYER_STATE1_3 (1 << 3)
#define PLAYER_STATE1_4 (1 << 4)
#define PLAYER_STATE1_5 (1 << 5)
#define PLAYER_STATE1_6 (1 << 6)
#define PLAYER_STATE1_7 (1 << 7)
#define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8)
#define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8) // Item change process has begun
#define PLAYER_STATE1_9 (1 << 9)
#define PLAYER_STATE1_10 (1 << 10)
#define PLAYER_STATE1_11 (1 << 11)
#define PLAYER_STATE1_ACTOR_CARRY (1 << 11) // Currently carrying an actor
#define PLAYER_STATE1_12 (1 << 12)
#define PLAYER_STATE1_13 (1 << 13)
#define PLAYER_STATE1_14 (1 << 14)
Expand Down Expand Up @@ -690,14 +690,14 @@ typedef struct WeaponInfo {
#define PLAYER_STATE2_6 (1 << 6)
#define PLAYER_STATE2_7 (1 << 7)
#define PLAYER_STATE2_8 (1 << 8)
#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9)
#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9) // Forces sand footstep sounds regardless of current floor type
#define PLAYER_STATE2_10 (1 << 10)
#define PLAYER_STATE2_11 (1 << 11)
#define PLAYER_STATE2_12 (1 << 12)
#define PLAYER_STATE2_13 (1 << 13)
#define PLAYER_STATE2_14 (1 << 14)
#define PLAYER_STATE2_15 (1 << 15)
#define PLAYER_STATE2_DO_ACTION_ENTER (1 << 16) // Turns on the "Enter On A" DoAction
#define PLAYER_STATE2_DO_ACTION_ENTER (1 << 16) // Sets the "Enter On A" DoAction
#define PLAYER_STATE2_17 (1 << 17)
#define PLAYER_STATE2_CRAWLING (1 << 18) // Crawling through a crawlspace
#define PLAYER_STATE2_19 (1 << 19)
Expand Down
6 changes: 3 additions & 3 deletions src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ int func_8002DD78(Player* player) {
int func_8002DDA8(PlayState* play) {
Player* player = GET_PLAYER(play);

return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player);
return (player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) || func_8002DD78(player);
}

s32 func_8002DDE4(PlayState* play) {
Expand Down Expand Up @@ -1811,7 +1811,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange
Player_GetExplosiveHeld(player) < 0) {
if ((((player->heldActor != NULL) || (actor == player->talkActor)) && (getItemId > GI_NONE) &&
(getItemId < GI_MAX)) ||
(!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) {
(!(player->stateFlags1 & (PLAYER_STATE1_ACTOR_CARRY | PLAYER_STATE1_29)))) {
if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) {
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
s32 absYawDiff = ABS(yawDiff);
Expand Down Expand Up @@ -1880,7 +1880,7 @@ u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
Player* player = GET_PLAYER(play);

if (!(player->stateFlags1 &
(PLAYER_STATE1_7 | PLAYER_STATE1_11 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
(PLAYER_STATE1_7 | PLAYER_STATE1_ACTOR_CARRY | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 |
PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21))) {
player->rideActor = horse;
player->mountSide = mountSide;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -6607,7 +6607,7 @@ s32 Camera_Demo5(Camera* camera) {
sp4A = playerhead.rot.y - playerTargetGeo.yaw;
if (camera->target->category == ACTORCAT_PLAYER) {
framesDiff = camera->play->state.frames - sDemo5PrevAction12Frame;
if (player->stateFlags1 & PLAYER_STATE1_11) {
if (player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) {
// holding object over head.
Player_SetCsActionWithHaltedActors(camera->play, camera->target, PLAYER_CSACTION_8);
} else if (ABS(framesDiff) > 3000) {
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Matrix_Get(&sp14C);
Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0);
hookedActor->shape.rot = hookedActor->world.rot;
} else if (this->stateFlags1 & PLAYER_STATE1_11) {
} else if (this->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) {
Vec3s spB8;

Matrix_Get(&sp14C);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void func_808B57E0(BgSpot16Bombstone* this, PlayState* play) {
OnePointCutscene_Init(play, 4180, sTimer, NULL, CAM_ID_MAIN);
}
}
} else if (player->stateFlags1 & PLAYER_STATE1_11) {
} else if (player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) {
playerHeldActor = player->heldActor;
if (playerHeldActor != NULL && playerHeldActor->category == ACTORCAT_EXPLOSIVE &&
playerHeldActor->id == ACTOR_EN_BOMBF) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ void DoorShutter_SetupClosed(DoorShutter* this, PlayState* play) {
}
this->isActive = false;
this->dyna.actor.velocity.y = 0.0f;
if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_11)) {
if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY)) {
// The door is barred behind the player
DoorShutter_SetupAction(this, DoorShutter_WaitPlayerSurprised);
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_2);
Expand Down
4 changes: 2 additions & 2 deletions src/overlays/actors/ovl_En_Bom/z_en_bom.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ void EnBom_Explode(EnBom* this, PlayState* play) {
if (this->timer == 0) {
player = GET_PLAYER(play);

if ((player->stateFlags1 & PLAYER_STATE1_11) && (player->heldActor == &this->actor)) {
if ((player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) && (player->heldActor == &this->actor)) {
player->actor.child = NULL;
player->heldActor = NULL;
player->interactRangeActor = NULL;
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
}

Actor_Kill(&this->actor);
Expand Down
10 changes: 5 additions & 5 deletions src/overlays/actors/ovl_En_Bombf/z_en_bombf.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) {
player->heldActor = NULL;
player->interactRangeActor = NULL;
this->actor.parent = NULL;
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
}
} else if (this->bombCollider.base.acFlags & AC_HIT) {
this->bombCollider.base.acFlags &= ~AC_HIT;
Expand Down Expand Up @@ -197,7 +197,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) {
player->heldActor = NULL;
player->interactRangeActor = NULL;
this->actor.parent = NULL;
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
this->actor.world.pos = this->actor.home.pos;
}
}
Expand All @@ -215,7 +215,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) {
player->heldActor = NULL;
player->interactRangeActor = NULL;
this->actor.parent = NULL;
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
this->actor.world.pos = this->actor.home.pos;
}
}
Expand Down Expand Up @@ -299,11 +299,11 @@ void EnBombf_Explode(EnBombf* this, PlayState* play) {
if (this->timer == 0) {
player = GET_PLAYER(play);

if ((player->stateFlags1 & PLAYER_STATE1_11) && (player->heldActor == &this->actor)) {
if ((player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) && (player->heldActor == &this->actor)) {
player->actor.child = NULL;
player->heldActor = NULL;
player->interactRangeActor = NULL;
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
}

Actor_Kill(&this->actor);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) {

SkelAnime_Update(&this->skelAnime);
if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(play) &&
!(player->stateFlags1 & PLAYER_STATE1_11)) {
!(player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY)) {
OnePointCutscene_Init(play, 2230, -99, &this->actor, CAM_ID_MAIN);
this->timer = 0;
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8);
Expand Down
4 changes: 2 additions & 2 deletions src/overlays/actors/ovl_En_Ta/z_en_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ s32 EnTa_IsPlayerHoldingSuperCucco(EnTa* this, PlayState* play, s32 cuccoIdx) {
Player* player = GET_PLAYER(play);
Actor* interactRangeActor;

if (player->stateFlags1 & PLAYER_STATE1_11) {
if (player->stateFlags1 & PLAYER_STATE1_ACTOR_CARRY) {
interactRangeActor = player->interactRangeActor;
if (interactRangeActor != NULL && interactRangeActor->id == ACTOR_EN_NIW &&
interactRangeActor == &this->superCuccos[cuccoIdx]->actor) {
Expand Down Expand Up @@ -658,7 +658,7 @@ void EnTa_TalkFoundSuperCucco(EnTa* this, PlayState* play) {
if (player->heldActor == &this->superCuccos[lastFoundSuperCuccoIdx]->actor) {
player->heldActor = NULL;
}
player->stateFlags1 &= ~PLAYER_STATE1_11;
player->stateFlags1 &= ~PLAYER_STATE1_ACTOR_CARRY;
this->superCuccos[lastFoundSuperCuccoIdx] = NULL;
}
this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
Expand Down
Loading

0 comments on commit 900c2f0

Please sign in to comment.