summaryrefslogtreecommitdiff
path: root/src/code/z_actor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/code/z_actor.c')
-rw-r--r--src/code/z_actor.c81
1 files changed, 56 insertions, 25 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 52b113c76..1a2404c1a 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -172,7 +172,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) {
u8 shadowAlpha = actor->shape.shadowAlpha;
f32 alphaRatio;
- if ((actor->id == ACTOR_PLAYER) && (((Player*)actor)->stateFlags3 & 0x8000)) {
+ if ((actor->id == ACTOR_PLAYER) && (((Player*)actor)->stateFlags3 & PLAYER_STATE3_8000)) {
f32 prevScaleZ = actor->scale.z;
actor->scale.z += 0.03f * fabsf(Math_CosS(((Player*)actor)->unk_AAA));
@@ -469,7 +469,8 @@ void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, PlayState*
void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (!(player->stateFlags1 & 0x300006C2)) {
+ if (!(player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 |
+ PLAYER_STATE1_400 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) {
Actor* actor = targetCtx->targetedActor;
OPEN_DISPS(play->state.gfxCtx);
@@ -519,7 +520,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) {
Target_SetPos(targetCtx, targetCtx->unk4C, projectedPos.x, projectedPos.y, projectedPos.z);
- if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_730)) {
+ if ((!(player->stateFlags1 & PLAYER_STATE1_40)) || (actor != player->unk_730)) {
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39);
for (spB0 = 0, spAC = targetCtx->unk4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
@@ -1291,7 +1292,7 @@ void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw) {
f32 Player_GetHeight(Player* player) {
f32 extraHeight;
- if (player->stateFlags1 & 0x800000) {
+ if (player->stateFlags1 & PLAYER_STATE1_800000) {
extraHeight = 32.0f;
} else {
extraHeight = 0.0f;
@@ -1302,8 +1303,7 @@ f32 Player_GetHeight(Player* player) {
case PLAYER_FORM_FIERCE_DEITY:
return extraHeight + 124.0f;
case PLAYER_FORM_GORON:
- // (player->stateFlags3 & 0x1000): being curled?
- return extraHeight + ((player->stateFlags3 & 0x1000) ? 34.0f : 80.0f);
+ return extraHeight + ((player->stateFlags3 & PLAYER_STATE3_1000) ? 34.0f : 80.0f);
case PLAYER_FORM_ZORA:
return extraHeight + 68.0f;
case PLAYER_FORM_DEKU:
@@ -1314,9 +1314,9 @@ f32 Player_GetHeight(Player* player) {
}
f32 Player_GetRunSpeedLimit(Player* player) {
- if (player->stateFlags1 & 0x800000) {
+ if (player->stateFlags1 & PLAYER_STATE1_800000) {
return 15.0f;
- } else if (player->stateFlags1 & 0x8000000) {
+ } else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f;
} else {
return R_RUN_SPEED_LIMIT / 100.0f;
@@ -1324,7 +1324,7 @@ f32 Player_GetRunSpeedLimit(Player* player) {
}
s32 func_800B7118(Player* player) {
- return player->stateFlags1 & 0x8;
+ return player->stateFlags1 & PLAYER_STATE1_8;
}
s32 func_800B7128(Player* player) {
@@ -1334,7 +1334,7 @@ s32 func_800B7128(Player* player) {
s32 func_800B715C(PlayState* play) {
Player* player = GET_PLAYER(play);
- return player->stateFlags2 & 0x8;
+ return player->stateFlags2 & PLAYER_STATE2_8;
}
void Actor_SetCameraHorseSetting(PlayState* play, Player* player) {
@@ -1349,12 +1349,12 @@ void Actor_SetCameraHorseSetting(PlayState* play, Player* player) {
void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) {
player->rideActor = horse;
- player->stateFlags1 |= 0x800000;
+ player->stateFlags1 |= PLAYER_STATE1_800000;
horse->child = &player->actor;
}
s32 func_800B7200(Player* player) {
- return (player->stateFlags1 & 0x20000080) || (player->csMode != 0);
+ return (player->stateFlags1 & (PLAYER_STATE1_20000000 | PLAYER_STATE1_80)) || (player->csMode != 0);
}
void func_800B722C(GameState* gameState, Player* player) {
@@ -1999,13 +1999,16 @@ s32 Actor_HasParent(Actor* actor, PlayState* play) {
s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) {
Player* player = GET_PLAYER(play);
- if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
+ if (!(player->stateFlags1 &
+ (PLAYER_STATE1_80 | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 |
+ PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) &&
+ Player_GetExplosiveHeld(player) < 0) {
if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) {
if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES ||
getItemId == GI_DEED_LAND ||
((player->heldActor != NULL || actor == player->targetActor) &&
(getItemId > GI_NONE && getItemId < GI_MAX))) ||
- !(player->stateFlags1 & 0x20000800)) {
+ !(player->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000))) {
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
s32 absYawDiff = ABS_ALT(yawDiff);
@@ -2081,7 +2084,9 @@ s32 Actor_HasRider(PlayState* play, Actor* horse) {
s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
Player* player = GET_PLAYER(play);
- if (!(player->stateFlags1 & 0x003C7880)) {
+ if (!(player->stateFlags1 &
+ (PLAYER_STATE1_80 | PLAYER_STATE1_800 | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 |
+ PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000))) {
player->rideActor = horse;
player->mountSide = mountSide;
ActorCutscene_SetIntentToPlay(0x7C);
@@ -2353,7 +2358,7 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
if (((params->unk_08) && !(actor->flags & params->unk_08)) ||
((tmp = (params->unk_08 == 0)) &&
(!(actor->flags & ACTOR_FLAG_100000) ||
- ((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & 0x200))) &&
+ ((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & PLAYER_STATE1_200))) &&
(params->unkC != 0) && (actor != params->unk10) && ((actor != params->player->heldActor)) &&
(actor->parent != &params->player->actor))) {
CollisionCheck_ResetDamage(&actor->colChkInfo);
@@ -2395,9 +2400,35 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) {
return nextActor;
}
-u32 D_801AED58[] = {
- 0x100002C2, 0x100002C2, 0x00000200, 0x100006C2, 0x00000282, 0x300002C2,
- 0x10000282, 0x00000002, 0x300002C2, 0x100006C2, 0x00000002, 0x100002C2,
+u32 D_801AED58[ACTORCAT_MAX] = {
+ /* ACTORCAT_SWITCH */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
+ /* ACTORCAT_BG */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
+ /* ACTORCAT_PLAYER */
+ PLAYER_STATE1_200,
+ /* ACTORCAT_EXPLOSIVES */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_400 |
+ PLAYER_STATE1_10000000,
+ /* ACTORCAT_NPC */
+ PLAYER_STATE1_2 | PLAYER_STATE1_80 | PLAYER_STATE1_200,
+ /* ACTORCAT_ENEMY */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 |
+ PLAYER_STATE1_20000000,
+ /* ACTORCAT_PROP */
+ PLAYER_STATE1_2 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
+ /* ACTORCAT_ITEMACTION */
+ PLAYER_STATE1_2,
+ /* ACTORCAT_MISC */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 |
+ PLAYER_STATE1_20000000,
+ /* ACTORCAT_BOSS */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_400 |
+ PLAYER_STATE1_10000000,
+ /* ACTORCAT_DOOR */
+ PLAYER_STATE1_2,
+ /* ACTORCAT_CHEST */
+ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000,
};
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
@@ -2427,13 +2458,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
tmp = D_801AED58;
- if (player->stateFlags2 & 0x8000000) {
+ if (player->stateFlags2 & PLAYER_STATE2_8000000) {
params.unk_08 = 0x2000000;
} else {
params.unk_08 = 0;
}
- if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x1900)) {
+ if ((player->stateFlags1 & PLAYER_STATE1_40) && ((player->actor.textId & 0xFF00) != 0x1900)) {
params.unk10 = player->targetActor;
} else {
params.unk10 = NULL;
@@ -2486,7 +2517,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
}
}
- if (!(player->stateFlags1 & 2)) {
+ if (!(player->stateFlags1 & PLAYER_STATE1_2)) {
func_800B5814(&actorCtx->targetContext, player, actor, &play->state);
}
@@ -2835,7 +2866,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
if (play->actorCtx.lensActive) {
Math_StepToC(&play->actorCtx.lensMaskSize, LENS_MASK_ACTIVE_SIZE, 20);
- if (GET_PLAYER(play)->stateFlags2 & 0x8000000) {
+ if (GET_PLAYER(play)->stateFlags2 & PLAYER_STATE2_8000000) {
Actor_DeactivateLens(play);
}
} else {
@@ -3658,7 +3689,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16
s32 Actor_IsTargeted(PlayState* play, Actor* actor) {
Player* player = GET_PLAYER(play);
- if ((player->stateFlags3 & 0x80000000) && actor->isTargeted) {
+ if ((player->stateFlags3 & PLAYER_STATE3_80000000) && actor->isTargeted) {
return true;
}
@@ -3671,7 +3702,7 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor) {
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) {
Player* player = GET_PLAYER(play);
- if ((player->stateFlags3 & 0x80000000) && !actor->isTargeted) {
+ if ((player->stateFlags3 & PLAYER_STATE3_80000000) && !actor->isTargeted) {
return true;
}