diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 52 | ||||
| -rw-r--r-- | src/code/z_camera.c | 37 | ||||
| -rw-r--r-- | src/code/z_onepointdemo.c | 4 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 22 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 57 |
5 files changed, 97 insertions, 75 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 2d1e06c30..235702d20 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -351,7 +351,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); - if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) { + if ((!(player->stateFlags1 & PLAYER_STATE1_6)) || (actor != player->unk_664)) { OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39); for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { @@ -948,7 +948,7 @@ f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) { } f32 Player_GetHeight(Player* player) { - f32 offset = (player->stateFlags1 & 0x800000) ? 32.0f : 0.0f; + f32 offset = (player->stateFlags1 & PLAYER_STATE1_23) ? 32.0f : 0.0f; if (LINK_IS_ADULT) { return offset + 68.0f; @@ -958,9 +958,9 @@ f32 Player_GetHeight(Player* player) { } f32 func_8002DCE4(Player* player) { - if (player->stateFlags1 & 0x800000) { + if (player->stateFlags1 & PLAYER_STATE1_23) { return 8.0f; - } else if (player->stateFlags1 & 0x8000000) { + } else if (player->stateFlags1 & PLAYER_STATE1_27) { return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f; } else { return R_RUN_SPEED_LIMIT / 100.0f; @@ -968,7 +968,7 @@ f32 func_8002DCE4(Player* player) { } s32 func_8002DD6C(Player* player) { - return player->stateFlags1 & 0x8; + return player->stateFlags1 & PLAYER_STATE1_3; } s32 func_8002DD78(Player* player) { @@ -978,19 +978,19 @@ s32 func_8002DD78(Player* player) { s32 func_8002DDA8(GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - return (player->stateFlags1 & 0x800) || func_8002DD78(player); + return (player->stateFlags1 & PLAYER_STATE1_11) || func_8002DD78(player); } s32 func_8002DDE4(GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - return player->stateFlags2 & 0x8; + return player->stateFlags2 & PLAYER_STATE2_3; } s32 func_8002DDF4(GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - return player->stateFlags2 & 0x1000; + return player->stateFlags2 & PLAYER_STATE2_12; } void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { @@ -1012,12 +1012,12 @@ void func_8002DE74(GlobalContext* globalCtx, Player* player) { void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse) { player->rideActor = horse; - player->stateFlags1 |= 0x800000; + player->stateFlags1 |= PLAYER_STATE1_23; horse->child = &player->actor; } s32 func_8002DEEC(Player* player) { - return (player->stateFlags1 & 0x20000080) || (player->csMode != 0); + return (player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (player->csMode != 0); } void func_8002DF18(GlobalContext* globalCtx, Player* player) { @@ -1568,10 +1568,12 @@ u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { Player* player = GET_PLAYER(globalCtx); - if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { + if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | + PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) && + Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) && (getItemId < GI_MAX)) || - (!(player->stateFlags1 & 0x20000800))) { + (!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS(yawDiff); @@ -1639,7 +1641,9 @@ s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { Player* player = GET_PLAYER(globalCtx); - if (!(player->stateFlags1 & 0x003C7880)) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_7 | PLAYER_STATE1_11 | 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; return true; @@ -1983,8 +1987,18 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* } u32 D_80116068[ACTORCAT_MAX] = { - 0x100000C0, 0x100000C0, 0x00000000, 0x100004C0, 0x00000080, 0x300000C0, - 0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, + 0, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28, + PLAYER_STATE1_7, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29, + PLAYER_STATE1_7 | PLAYER_STATE1_28, + 0, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28, + 0, + PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, }; void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { @@ -2029,11 +2043,11 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp80 = &D_80116068[0]; - if (player->stateFlags2 & 0x8000000) { + if (player->stateFlags2 & PLAYER_STATE2_27) { unkFlag = ACTOR_FLAG_25; } - if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) { + if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) { sp74 = player->targetActor; } @@ -3389,7 +3403,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { Player* player = GET_PLAYER(globalCtx); - if ((player->stateFlags1 & 0x10) && actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_4) && actor->isTargeted) { return true; } else { return false; @@ -3402,7 +3416,7 @@ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) { Player* player = GET_PLAYER(globalCtx); - if ((player->stateFlags1 & 0x10) && !actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_4) && !actor->isTargeted) { return true; } else { return false; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index dfbf8a049..f5e9287c7 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -511,7 +511,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { return -1; } - if (!(camera->player->stateFlags1 & 0x8000000)) { + if (!(camera->player->stateFlags1 & PLAYER_STATE1_27)) { // player is not swimming *waterY = BGCHECK_Y_MIN; return -1; @@ -1021,7 +1021,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_21) { *arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, PCT(OREG(43)), 0.1f); phi_f20 = playerPosRot->pos.y - *arg3; posOffsetTarget.y -= phi_f20; @@ -1124,7 +1124,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f tmpPos0.z = tmpPos0.z + lookFromOffset.z; if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_21) { *yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, PCT(OREG(43)), 0.1f); yPosDelta = playerPosRot->pos.y - *yPosOffset; tmpPos0.y -= yPosDelta; @@ -2059,7 +2059,7 @@ s32 Camera_Parallel1(Camera* camera) { } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_21) { anim->yTarget = playerPosRot->pos.y; sp6A = 0; } else { @@ -2748,7 +2748,7 @@ s32 Camera_Battle1(Camera* camera) { sp78 = batt1->swingPitchFinal; fov = batt1->fov; - if (camera->player->stateFlags1 & 0x1000) { + if (camera->player->stateFlags1 & PLAYER_STATE1_12) { // charging sword. anim->unk_10 = Camera_LERPCeilF(PCT(OREG(12)) * 0.5f, anim->unk_10, PCT(OREG(25)), 0.1f); camera->xzOffsetUpdateRate = Camera_LERPCeilF(0.2f, camera->xzOffsetUpdateRate, PCT(OREG(25)), 0.1f); @@ -2819,7 +2819,7 @@ s32 Camera_Battle1(Camera* camera) { } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_21) { isOffGround = false; anim->yPosOffset = playerPosRot->pos.y; } else { @@ -3139,7 +3139,7 @@ s32 Camera_KeepOn1(Camera* camera) { anim->unk_0C = NULL; cont: if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_21) { anim->unk_08 = playerPosRot->pos.y; sp80 = 0; } else { @@ -3560,7 +3560,7 @@ s32 Camera_KeepOn4(Camera* camera) { keep4->unk_04 = playerHeight * 1.6f * yNormal; keep4->unk_08 = -2.0f; keep4->unk_0C = 120.0f; - keep4->unk_10 = player->stateFlags1 & 0x8000000 ? 0.0f : 20.0f; + keep4->unk_10 = player->stateFlags1 & PLAYER_STATE1_27 ? 0.0f : 20.0f; keep4->unk_1C = 0x3212; keep4->unk_1E = 0x1E; keep4->unk_18 = 50.0f; @@ -4813,7 +4813,7 @@ s32 Camera_Unique0(Camera* camera) { camera->animState++; } - if (player->stateFlags1 & 0x20000000) { + if (player->stateFlags1 & PLAYER_STATE1_29) { anim->initalPos = playerPosRot->pos; } @@ -4821,7 +4821,7 @@ s32 Camera_Unique0(Camera* camera) { if (anim->animTimer > 0) { anim->animTimer--; anim->initalPos = playerPosRot->pos; - } else if ((!(player->stateFlags1 & 0x20000000)) && + } else if ((!(player->stateFlags1 & PLAYER_STATE1_29)) && ((OLib_Vec3fDistXZ(&playerPosRot->pos, &anim->initalPos) >= 10.0f) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) || @@ -4849,7 +4849,7 @@ s32 Camera_Unique0(Camera* camera) { anim->initalPos = playerPosRot->pos; } - if ((!(player->stateFlags1 & 0x20000000)) && + if ((!(player->stateFlags1 & PLAYER_STATE1_29)) && ((0.001f < camera->xzSpeed) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_CLEFT) || @@ -5066,7 +5066,8 @@ s32 Camera_Unique9(Camera* camera) { D_8011D3AC = anim->curKeyFrame->unk_01 & 0xF; } else if ((anim->curKeyFrame->unk_01 & 0xF0) == 0xC0) { Camera_UpdateInterface(0xF000 | ((anim->curKeyFrame->unk_01 & 0xF) << 8)); - } else if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { + } else if (camera->player->stateFlags1 & PLAYER_STATE1_27 && + player->currentBoots != PLAYER_BOOTS_IRON) { func_8002DF38(camera->globalCtx, camera->target, 8); osSyncPrintf("camera: demo: player demo set WAIT\n"); } else { @@ -5442,7 +5443,7 @@ s32 Camera_Unique9(Camera* camera) { // Set the player's position camera->player->actor.world.pos.x = anim->playerPos.x; camera->player->actor.world.pos.z = anim->playerPos.z; - if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { + if (camera->player->stateFlags1 & PLAYER_STATE1_27 && player->currentBoots != PLAYER_BOOTS_IRON) { camera->player->actor.world.pos.y = anim->playerPos.y; } } else { @@ -6003,16 +6004,16 @@ s32 Camera_Demo5(Camera* camera) { sDemo5PrevSfxFrame = camera->globalCtx->state.frames; - if (camera->player->stateFlags1 & 0x8000000 && (player->currentBoots != PLAYER_BOOTS_IRON)) { + if (camera->player->stateFlags1 & PLAYER_STATE1_27 && (player->currentBoots != PLAYER_BOOTS_IRON)) { // swimming, and not iron boots - player->stateFlags1 |= 0x20000000; + player->stateFlags1 |= PLAYER_STATE1_29; // env frozen player->actor.freezeTimer = camera->timer; } else { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; - if (player->stateFlags1 & 0x800) { + if (player->stateFlags1 & PLAYER_STATE1_11) { // holding object over head. func_8002DF54(camera->globalCtx, camera->target, 8); } else if (ABS(pad) > 3000) { @@ -7072,7 +7073,7 @@ s32 Camera_CheckWater(Camera* camera) { } if (camera->unk_14C & 0x200) { - if (player->stateFlags2 & 0x800) { + if (player->stateFlags2 & PLAYER_STATE2_11) { Camera_ChangeSettingFlags(camera, CAM_SET_PIVOT_WATER_SURFACE, 6); camera->unk_14C |= (s16)0x8000; } else if (camera->unk_14C & (s16)0x8000) { @@ -7556,7 +7557,7 @@ void Camera_Finish(Camera* camera) { if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) { player->actor.freezeTimer = 0; - player->stateFlags1 &= ~0x20000000; + player->stateFlags1 &= ~PLAYER_STATE1_29; if (player->csMode != 0) { func_8002DF54(camera->globalCtx, &player->actor, 7); diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 96ef33c18..4a8f9e738 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -769,7 +769,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF54(globalCtx, NULL, 8); func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - player->stateFlags1 |= 0x20000000; + player->stateFlags1 |= PLAYER_STATE1_29; player->actor.freezeTimer = 90; i = Quake_Add(csCam, 1); @@ -966,7 +966,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act if (func_800C0CB8(globalCtx)) { D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; - if (player->stateFlags1 & 0x08000000) { + if (player->stateFlags1 & PLAYER_STATE1_27) { D_801231B4[2].atTargetInit.z = 0.0f; } Actor_GetWorldPosShapeRot(&spA0, &player->actor); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 45983cc03..fdee59c95 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -612,7 +612,7 @@ void func_80083108(GlobalContext* globalCtx) { ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutsceneIndex == 0xFFF0))) { gSaveContext.unk_13E7 = 0; - if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) || + if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) || ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { gSaveContext.unk_13E7 = 1; @@ -661,11 +661,11 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(8); } else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { Interface_ChangeAlpha(8); - } else if (player->stateFlags1 & 0x00800000) { + } else if (player->stateFlags1 & PLAYER_STATE1_23) { Interface_ChangeAlpha(12); } } else { - if (player->stateFlags1 & 0x00800000) { + if (player->stateFlags1 & PLAYER_STATE1_23) { Interface_ChangeAlpha(12); } } @@ -743,7 +743,7 @@ void func_80083108(GlobalContext* globalCtx) { } Interface_ChangeAlpha(50); - } else if ((player->stateFlags1 & 0x00200000) || (player->stateFlags2 & 0x00040000)) { + } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (player->stateFlags2 & PLAYER_STATE2_18)) { if (gSaveContext.buttonStatus[0] != BTN_DISABLED) { gSaveContext.buttonStatus[0] = BTN_DISABLED; gSaveContext.buttonStatus[1] = BTN_DISABLED; @@ -753,7 +753,7 @@ void func_80083108(GlobalContext* globalCtx) { Interface_ChangeAlpha(50); } } else if ((gSaveContext.eventInf[0] & 0xF) == 1) { - if (player->stateFlags1 & 0x00800000) { + if (player->stateFlags1 & PLAYER_STATE1_23) { if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) && (gSaveContext.equips.buttonItems[0] != ITEM_BOW)) { if (gSaveContext.inventory.items[SLOT_BOW] == ITEM_NONE) { @@ -2730,8 +2730,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { temp = 0; - } else if ((player->stateFlags1 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) || - (player->stateFlags2 & 0x00040000)) { + } else if ((player->stateFlags1 & PLAYER_STATE1_21) || (func_8008F2F8(globalCtx) == 4) || + (player->stateFlags2 & PLAYER_STATE2_18)) { temp = 70; } else { temp = interfaceCtx->healthAlpha; @@ -3157,7 +3157,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if (gSaveContext.equips.buttonItems[0] != ITEM_NONE) { Interface_DrawItemIconTexture(globalCtx, interfaceCtx->iconItemSegment, 0); - if ((player->stateFlags1 & 0x00800000) || (globalCtx->shootingGalleryStatus > 1) || + if ((player->stateFlags1 & PLAYER_STATE1_23) || (globalCtx->shootingGalleryStatus > 1) || ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, @@ -3403,7 +3403,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && + !(player->stateFlags2 & PLAYER_STATE2_24) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx) && (gSaveContext.minigameState != 1) && (globalCtx->shootingGalleryStatus <= 1) && !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { @@ -3962,8 +3962,8 @@ void Interface_Update(GlobalContext* globalCtx) { HealthMeter_Update(globalCtx); if ((gSaveContext.timer1State >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && - (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {} + (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) && + (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) {} if (gSaveContext.rupeeAccumulator != 0) { if (gSaveContext.rupeeAccumulator > 0) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index b1707a565..71b14e252 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -293,7 +293,7 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) { currentBoots = PLAYER_BOOTS_NORMAL_CHILD; } } else if (currentBoots == PLAYER_BOOTS_IRON) { - if (this->stateFlags1 & 0x8000000) { + if (this->stateFlags1 & PLAYER_STATE1_27) { currentBoots = PLAYER_BOOTS_IRON_UNDERWATER; } REG(27) = 500; @@ -325,8 +325,9 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) { } s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) { - return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (globalCtx->sceneLoadFlag == 0x14) || - (this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) || + return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) || + (globalCtx->sceneLoadFlag == 0x14) || (this->stateFlags1 & PLAYER_STATE1_0) || + (this->stateFlags3 & PLAYER_STATE3_7) || ((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0)); } @@ -337,7 +338,7 @@ s32 Player_InCsMode(GlobalContext* globalCtx) { } s32 func_8008E9C4(Player* this) { - return (this->stateFlags1 & 0x10); + return (this->stateFlags1 & PLAYER_STATE1_4); } s32 Player_IsChildWithHylianShield(Player* this) { @@ -355,7 +356,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { } void Player_SetModelsForHoldingShield(Player* this) { - if ((this->stateFlags1 & 0x400000) && + if ((this->stateFlags1 & PLAYER_STATE1_22) && ((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) { if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = 10; @@ -431,15 +432,18 @@ void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s void func_8008EDF0(Player* this) { this->unk_664 = NULL; - this->stateFlags2 &= ~0x2000; + this->stateFlags2 &= ~PLAYER_STATE2_13; } void func_8008EE08(Player* this) { - if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & 0x8A00000) || - (!(this->stateFlags1 & 0xC0000) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { - this->stateFlags1 &= ~0x400F8000; - } else if (!(this->stateFlags1 & 0x2C0000)) { - this->stateFlags1 |= 0x80000; + if ((this->actor.bgCheckFlags & 1) || + (this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) || + (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) && + ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { + this->stateFlags1 &= ~(PLAYER_STATE1_15 | PLAYER_STATE1_16 | PLAYER_STATE1_17 | PLAYER_STATE1_18 | + PLAYER_STATE1_19 | PLAYER_STATE1_30); + } else if (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_21))) { + this->stateFlags1 |= PLAYER_STATE1_19; } func_8008EDF0(this); @@ -451,7 +455,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { func_8008EE08(this); this->unk_664 = actor; this->unk_684 = actor; - this->stateFlags1 |= 0x10000; + this->stateFlags1 |= PLAYER_STATE1_16; Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor); Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2); } @@ -459,7 +463,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { s32 func_8008EF30(GlobalContext* globalCtx) { Player* this = GET_PLAYER(globalCtx); - return (this->stateFlags1 & 0x800000); + return (this->stateFlags1 & PLAYER_STATE1_23); } s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) { @@ -616,7 +620,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { } else if ((this->unk_840 > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) ? 1 : 3; - } else if (this->stateFlags1 & 0x8000000) { // Swimming + } else if (this->stateFlags1 & PLAYER_STATE1_27) { // Swimming var = 2; } else { return 0; @@ -779,7 +783,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, s16 temp2; s32 temp3; - if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & 0x80) && + if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) && (Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) { s32 pad; @@ -923,10 +927,11 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if ((D_80160014 == 4) && (gSaveContext.swordHealth <= 0.0f)) { dLists += 4; - } else if ((D_80160014 == 6) && (this->stateFlags1 & 0x2000000)) { + } else if ((D_80160014 == 6) && (this->stateFlags1 & PLAYER_STATE1_25)) { dLists = &D_80125E08[gSaveContext.linkAge]; D_80160014 = 0; - } else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) { + } else if ((this->leftHandType == 0) && (this->actor.speedXZ > 2.0f) && + !(this->stateFlags1 & PLAYER_STATE1_27)) { dLists = &D_80125E18[gSaveContext.linkAge]; D_80160014 = 1; } @@ -937,7 +942,8 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if (D_80160018 == 10) { dLists += this->currentShield * 4; - } else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) { + } else if ((this->rightHandType == 8) && (this->actor.speedXZ > 2.0f) && + !(this->stateFlags1 & PLAYER_STATE1_27)) { dLists = &D_80125E58[gSaveContext.linkAge]; D_80160018 = 9; } @@ -1036,7 +1042,7 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide COLTYPE_METAL, }; - if (this->stateFlags1 & 0x400000) { + if (this->stateFlags1 & PLAYER_STATE1_22) { Vec3f quadDest[4]; this->shieldQuad.base.colType = shieldColTypes[this->currentShield]; @@ -1070,12 +1076,12 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) { Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); if (func_80090480(globalCtx, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) && - !(this->stateFlags1 & 0x400000)) { + !(this->stateFlags1 & PLAYER_STATE1_22)) { EffectBlure_AddVertex(Effect_GetByIndex(this->swordEffectIndex), &this->swordInfo[0].tip, &this->swordInfo[0].base); } - if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & 0x20000))) { + if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_17))) { func_80090480(globalCtx, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]); func_80090480(globalCtx, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]); } @@ -1272,13 +1278,13 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (this->actor.scale.y >= 0.0f) { if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) { - if (this->stateFlags1 & 0x200) { + if (this->stateFlags1 & PLAYER_STATE1_9) { Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos); Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); Matrix_Get(&sp14C); Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0); hookedActor->shape.rot = hookedActor->world.rot; - } else if (this->stateFlags1 & 0x800) { + } else if (this->stateFlags1 & PLAYER_STATE1_11) { Vec3s spB8; Matrix_Get(&sp14C); @@ -1308,7 +1314,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_Push(); Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY); - if ((this->stateFlags1 & 0x200) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) { + if ((this->stateFlags1 & PLAYER_STATE1_9) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) { Vec3f sp90; f32 distXYZ; @@ -1370,7 +1376,8 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } if ((this->unk_862 != 0) || ((func_8002DD6C(this) == 0) && (heldActor != NULL))) { - if (!(this->stateFlags1 & 0x400) && (this->unk_862 != 0) && (this->exchangeItemId != EXCH_ITEM_NONE)) { + if (!(this->stateFlags1 & PLAYER_STATE1_10) && (this->unk_862 != 0) && + (this->exchangeItemId != EXCH_ITEM_NONE)) { Math_Vec3f_Copy(&sGetItemRefPos, &this->leftHandPos); } else { sGetItemRefPos.x = (this->bodyPartsPos[15].x + this->leftHandPos.x) * 0.5f; |
