diff options
| author | Dragorn421 <Dragorn421@users.noreply.github.com> | 2021-12-06 01:11:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-05 19:11:38 -0500 |
| commit | a9284494f2b6f53a0e8f95b5567faf1b2162e91c (patch) | |
| tree | b09701e147c47f177fdcae2e8bcf6ea90a5bb85b /src/code | |
| parent | 79220ba58ae550441e42b4d2c79af7f7e4b9787b (diff) | |
Use defines for actor flags (#873)
* Add ACTOR_FLAG_ defines
* Add ACTOR_FLAGS_ALL macro and use ACTOR_FLAG_* constants everywhere
* Remove unused ACTOR_FLAG_* constants
* actor flags in bigokuta & ko
* actor flags in obj_mure
* actor flags in stalfos, twinrova & ganon2
* actor flags in morpha & barinade
* name some previously missed actor flags
* found some comments using hex for actor flags
* Actor flags in ovl_En_Ganon_Mant
* Actor flags in EnWf
* Flags in en_zf
* Actor flags in BossGanon (FeelsOKMan)
* Remove `ACTOR_FLAG_NONE`
* Wrap expansion of `FLAGS` in parentheses
* `ACTOR_FLAGS_ALL` -> `CHECK_FLAG_ALL`
* Move `CHECK_FLAG_ALL` to `macros.h`
* Run formatter
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_800430A0.c | 2 | ||||
| -rw-r--r-- | src/code/db_camera.c | 35 | ||||
| -rw-r--r-- | src/code/ucode_disas.c | 53 | ||||
| -rw-r--r-- | src/code/z_actor.c | 73 | ||||
| -rw-r--r-- | src/code/z_camera.c | 10 | ||||
| -rw-r--r-- | src/code/z_debug.c | 22 | ||||
| -rw-r--r-- | src/code/z_en_a_keep.c | 6 | ||||
| -rw-r--r-- | src/code/z_en_item00.c | 8 | ||||
| -rw-r--r-- | src/code/z_player_call.c | 2 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 2 |
10 files changed, 108 insertions, 105 deletions
diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index 673c60515..95c7c4fc5 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -62,7 +62,7 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) { if (dynaActor != NULL) { func_800434A8(dynaActor); - if ((actor->flags & 0x4000000) == 0x4000000) { + if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_26)) { func_80043538(dynaActor); } } diff --git a/src/code/db_camera.c b/src/code/db_camera.c index f7e565af2..f77dac120 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1300,8 +1300,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { DbCamera_SetTextValue(dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll, &D_8012D084[10], 3); func_8006376C(0x10, 0x16, (dbCamera->sub.unk_0A == 2) ? 7 : 4, D_8012D084); func_8006376C(0xF, 0x17, (dbCamera->sub.unk_0A == 3) ? 7 : 4, - (dbCamera->sub.mode == 1) ? D_8012CF14 - : (dbCamera->sub.mode == 0) ? *D_8012CF18 : D_8012CFB0); + (dbCamera->sub.mode == 1) ? D_8012CF14 + : (dbCamera->sub.mode == 0) ? *D_8012CF18 + : D_8012CFB0); if (dbCamera->sub.unk_0C) { D_8012D05C[80] = '>'; } else { @@ -1326,9 +1327,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { if (dbCamera->sub.mode != 1) { func_8006376C(3, 0x16, - ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) - ? 7 - : !D_80161144 ? 4 : 3, + ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7 + : !D_80161144 ? 4 + : 3, D_8012CF30); sp110 = 'X'; DbCamera_SetTextValue(dbCamera->at.x, &sp111, 6); @@ -1339,10 +1340,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { sp110 = 'Z'; DbCamera_SetTextValue(dbCamera->at.z, &sp111, 6); func_8006376C(3, 0x19, 2, &sp110); - func_8006376C( - 0x1E, 0x16, - ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 : D_80161144 ? 4 : 3, - D_8012CF34); + func_8006376C(0x1E, 0x16, + ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 + : D_80161144 ? 4 + : 3, + D_8012CF34); sp110 = 'X'; DbCamera_SetTextValue(dbCamera->eye.x, &sp111, 6); func_8006376C(0x1E, 0x17, 2, &sp110); @@ -1357,9 +1359,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp7C); spFC.yaw -= cam->playerPosRot.rot.y; func_8006376C(3, 0x16, - ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) - ? 7 - : !D_80161144 ? 4 : 3, + ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7 + : !D_80161144 ? 4 + : 3, D_8012CF30); DbCamera_SetTextValue(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4); func_8006376C(3, 0x17, 3, D_8012D0E4); @@ -1369,10 +1371,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { func_8006376C(3, 0x19, 3, D_8012D0D4); OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp80); spFC.yaw -= cam->playerPosRot.rot.y; - func_8006376C( - 0x1E, 0x16, - ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 : D_80161144 ? 4 : 3, - D_8012CF34); + func_8006376C(0x1E, 0x16, + ((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7 + : D_80161144 ? 4 + : 3, + D_8012CF34); DbCamera_SetTextValue(spFC.pitch * 0.00549325f, &D_8012D0E4[10], 4); func_8006376C(0x1C, 0x17, 3, D_8012D0E4); DbCamera_SetTextValue(spFC.yaw * 0.00549325f, &D_8012D0F8[10], 4); diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index c2ad06f52..b2588cc53 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -710,11 +710,10 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) { Gfillrect setscissor = ptr->fillrect; const char* modeStr; - modeStr = (setscissor.pad == G_SC_NON_INTERLACE) - ? "G_SC_NON_INTERLACE" - : (setscissor.pad == G_SC_ODD_INTERLACE) - ? "G_SC_ODD_INTERLACE" - : (setscissor.pad == G_SC_EVEN_INTERLACE) ? "G_SC_EVEN_INTERLACE" : "???"; + modeStr = (setscissor.pad == G_SC_NON_INTERLACE) ? "G_SC_NON_INTERLACE" + : (setscissor.pad == G_SC_ODD_INTERLACE) ? "G_SC_ODD_INTERLACE" + : (setscissor.pad == G_SC_EVEN_INTERLACE) ? "G_SC_EVEN_INTERLACE" + : "???"; if ((setscissor.x0frac | setscissor.y0frac | setscissor.x1frac | setscissor.y1frac)) { if (1) {} @@ -740,12 +739,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) { u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF; DISAS_LOG("gsDPSetColorImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x) ),", - (fmt == G_IM_FMT_RGBA) - ? "RGBA" - : (fmt == G_IM_FMT_YUV) ? "YUV" - : (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I", - (siz == G_IM_SIZ_4b) ? "4b" - : (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b", + (fmt == G_IM_FMT_RGBA) ? "RGBA" + : (fmt == G_IM_FMT_YUV) ? "YUV" + : (fmt == G_IM_FMT_CI) ? "CI" + : (fmt == G_IM_FMT_IA) ? "IA" + : "I", + (siz == G_IM_SIZ_4b) ? "4b" + : (siz == G_IM_SIZ_8b) ? "8b" + : (siz == G_IM_SIZ_16b) ? "16b" + : "32b", (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr); if (this->pipeSyncRequired) { @@ -768,12 +770,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) { u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF; DISAS_LOG("gsDPSetTextureImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x)),", - (fmt == G_IM_FMT_RGBA) - ? "RGBA" - : (fmt == G_IM_FMT_YUV) ? "YUV" - : (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I", - (siz == G_IM_SIZ_4b) ? "4b" - : (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b", + (fmt == G_IM_FMT_RGBA) ? "RGBA" + : (fmt == G_IM_FMT_YUV) ? "YUV" + : (fmt == G_IM_FMT_CI) ? "CI" + : (fmt == G_IM_FMT_IA) ? "IA" + : "I", + (siz == G_IM_SIZ_4b) ? "4b" + : (siz == G_IM_SIZ_8b) ? "8b" + : (siz == G_IM_SIZ_16b) ? "16b" + : "32b", (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr); } break; @@ -989,15 +994,11 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) { case G_MODIFYVTX: { DISAS_LOG("gsSPModifyVertex(%d, %s, %08x),", curGfx->dma.par, - (curGfx->dma.len == G_MWO_POINT_RGBA) - ? "G_MWO_POINT_RGBA" - : (curGfx->dma.len == G_MWO_POINT_ST) - ? "G_MWO_POINT_ST" - : (curGfx->dma.len == G_MWO_POINT_XYSCREEN) - ? "G_MWO_POINT_XYSCREEN" - : (curGfx->dma.len == G_MWO_POINT_ZSCREEN) - ? "G_MWO_POINT_ZSCREEN" - : "G_MWO_POINT_????", + (curGfx->dma.len == G_MWO_POINT_RGBA) ? "G_MWO_POINT_RGBA" + : (curGfx->dma.len == G_MWO_POINT_ST) ? "G_MWO_POINT_ST" + : (curGfx->dma.len == G_MWO_POINT_XYSCREEN) ? "G_MWO_POINT_XYSCREEN" + : (curGfx->dma.len == G_MWO_POINT_ZSCREEN) ? "G_MWO_POINT_ZSCREEN" + : "G_MWO_POINT_????", curGfx->dma.addr); this->vtxCnt += curGfx->dma.par; this->spvtxCnt++; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 5d5f86f1a..4f23e2c78 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -391,7 +391,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { } actor = targetCtx->unk_94; - if ((actor != NULL) && !(actor->flags & 0x8000000)) { + if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) { NaviColor* naviColor = &sNaviColorList[actor->category]; POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x7); @@ -484,7 +484,8 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl targetCtx->unk_48 = 0; } - lockOnSfxId = ((actorArg->flags & 5) == 5) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN; + lockOnSfxId = CHECK_FLAG_ALL(actorArg->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON + : NA_SE_SY_LOCK_ON_HUMAN; func_80078884(lockOnSfxId); } @@ -762,7 +763,7 @@ s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) { void Actor_Kill(Actor* actor) { actor->draw = NULL; actor->update = NULL; - actor->flags &= ~0x1; + actor->flags &= ~ACTOR_FLAG_0; } void Actor_SetWorldToHome(Actor* actor) { @@ -999,8 +1000,8 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { hookshot->grabbedDistDiff.x = 0.0f; hookshot->grabbedDistDiff.y = 0.0f; hookshot->grabbedDistDiff.z = 0.0f; - actorB->flags |= 0x2000; - actorA->flags &= ~0x2000; + actorB->flags |= ACTOR_FLAG_13; + actorA->flags &= ~ACTOR_FLAG_13; } void func_8002DE74(GlobalContext* globalCtx, Player* player) { @@ -1435,7 +1436,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { s16 yawTempAbs = ABS(yawTemp); if (player->unk_664 != NULL) { - if ((yawTempAbs > 0x4000) || (actor->flags & 0x8000000)) { + if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) { return FLT_MAX; } else { f32 ret = @@ -1471,7 +1472,7 @@ u32 func_8002F090(Actor* actor, f32 arg1) { } s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { - if ((actor->update == NULL) || !(actor->flags & 1)) { + if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) { return true; } @@ -1493,8 +1494,8 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { } u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) { - if (actor->flags & 0x100) { - actor->flags &= ~0x100; + if (actor->flags & ACTOR_FLAG_8) { + actor->flags &= ~ACTOR_FLAG_8; return true; } @@ -1505,7 +1506,7 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3 Player* player = GET_PLAYER(globalCtx); // This is convoluted but it seems like it must be a single if statement to match - if ((player->actor.flags & 0x100) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || + if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || (!actor->isTargeted && ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || (arg2 < actor->xzDistToPlayer)))) { @@ -1708,30 +1709,30 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { void func_8002F8F0(Actor* actor, u16 sfxId) { actor->sfx = sfxId; - actor->flags |= 0x80000; - actor->flags &= ~0x10300000; + actor->flags |= ACTOR_FLAG_19; + actor->flags &= ~(ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28); } void func_8002F91C(Actor* actor, u16 sfxId) { actor->sfx = sfxId; - actor->flags |= 0x100000; - actor->flags &= ~0x10280000; + actor->flags |= ACTOR_FLAG_20; + actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_21 | ACTOR_FLAG_28); } void func_8002F948(Actor* actor, u16 sfxId) { actor->sfx = sfxId; - actor->flags |= 0x200000; - actor->flags &= ~0x10180000; + actor->flags |= ACTOR_FLAG_21; + actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_28); } void func_8002F974(Actor* actor, u16 sfxId) { - actor->flags &= ~0x10380000; + actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28); actor->sfx = sfxId; } void func_8002F994(Actor* actor, s32 arg1) { - actor->flags |= 0x10000000; - actor->flags &= ~0x00380000; + actor->flags |= ACTOR_FLAG_28; + actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21); if (arg1 < 40) { actor->sfx = NA_SE_PL_WALK_DIRT - SFX_FLAG; } else if (arg1 < 100) { @@ -2029,7 +2030,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp80 = &D_80116068[0]; if (player->stateFlags2 & 0x8000000) { - unkFlag = 0x2000000; + unkFlag = ACTOR_FLAG_25; } if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) { @@ -2076,9 +2077,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer); actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor); - actor->flags &= ~0x1000000; + actor->flags &= ~ACTOR_FLAG_24; - if ((DECR(actor->freezeTimer) == 0) && (actor->flags & 0x50)) { + if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) { if (actor == player->unk_664) { actor->isTargeted = true; } else { @@ -2160,10 +2161,10 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->world.pos); + Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos); Lights_Draw(lights, globalCtx->state.gfxCtx); - if (actor->flags & 0x1000) { + if (actor->flags & ACTOR_FLAG_12) { func_800D1694(actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), @@ -2217,13 +2218,13 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { } void func_80030ED8(Actor* actor) { - if (actor->flags & 0x80000) { + if (actor->flags & ACTOR_FLAG_19) { Audio_PlaySoundGeneral(actor->sfx, &actor->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } else if (actor->flags & 0x100000) { + } else if (actor->flags & ACTOR_FLAG_20) { func_80078884(actor->sfx); - } else if (actor->flags & 0x200000) { + } else if (actor->flags & ACTOR_FLAG_21) { func_800788CC(actor->sfx); - } else if (actor->flags & 0x10000000) { + } else if (actor->flags & ACTOR_FLAG_28) { func_800F4C58(&D_801333D4, NA_SE_SY_TIMER - SFX_FLAG, (s8)(actor->sfx - 1)); } else { func_80078914(&actor->projectedPos, actor->sfx); @@ -2372,17 +2373,17 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { if (func_800314B0(globalCtx, actor)) { - actor->flags |= 0x40; + actor->flags |= ACTOR_FLAG_6; } else { - actor->flags &= ~0x40; + actor->flags &= ~ACTOR_FLAG_6; } } actor->isDrawn = false; if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { - if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) { - if ((actor->flags & 0x80) && + if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { + if ((actor->flags & ACTOR_FLAG_7) && ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) || (actor->room != globalCtx->roomCtx.curRoom.num))) { ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX, @@ -2889,11 +2890,11 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla sp84 = player->unk_664; while (actor != NULL) { - if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) { + if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) { // This block below is for determining the closest actor to player in determining the volume // used while playing enemy bgm music - if ((actorCategory == ACTORCAT_ENEMY) && ((actor->flags & 5) == 5) && + if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) && (actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sbgmEnemyDistSq)) { actorCtx->targetCtx.bgmEnemy = actor; sbgmEnemyDistSq = actor->xyzDistToPlayerSq; @@ -3845,10 +3846,10 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { } if (arg3 < var) { - actor->flags &= ~1; + actor->flags &= ~ACTOR_FLAG_0; Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1); } else { - actor->flags |= 1; + actor->flags |= ACTOR_FLAG_0; Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1); } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 5904c4733..041d0f9e7 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1690,9 +1690,9 @@ s32 Camera_Normal2(Camera* camera) { anim->unk_20 = BGCAM_ROT(bgData).x; anim->unk_22 = BGCAM_ROT(bgData).y; anim->unk_24 = playerPosRot->pos.y; - anim->unk_1C = BGCAM_FOV(bgData) == -1 - ? norm2->unk_14 - : BGCAM_FOV(bgData) >= 0x169 ? PCT(BGCAM_FOV(bgData)) : BGCAM_FOV(bgData); + anim->unk_1C = BGCAM_FOV(bgData) == -1 ? norm2->unk_14 + : BGCAM_FOV(bgData) >= 0x169 ? PCT(BGCAM_FOV(bgData)) + : BGCAM_FOV(bgData); anim->unk_28 = BGCAM_JFIFID(bgData) == -1 ? 0 : BGCAM_JFIFID(bgData); @@ -2923,7 +2923,9 @@ s32 Camera_Battle1(Camera* camera) { } anim->roll += (((OREG(36) * camera->speedRatio) * (1.0f - distRatio)) - anim->roll) * PCT(OREG(37)); camera->roll = DEGF_TO_BINANG(anim->roll); - camera->fov = Camera_LERPCeilF((player->swordState != 0 ? 0.8f : gSaveContext.health <= 0x10 ? 0.8f : 1.0f) * + camera->fov = Camera_LERPCeilF((player->swordState != 0 ? 0.8f + : gSaveContext.health <= 0x10 ? 0.8f + : 1.0f) * (fov - ((fov * 0.05f) * distRatio)), camera->fov, camera->fovUpdateRate, 1.0f); } diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 2949f0ef9..8b2a6fe93 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -151,19 +151,15 @@ void func_8006390C(Input* input) { gGameInfo->dpadLast = dpad; } - increment = CHECK_BTN_ANY(dpad, BTN_DRIGHT) - ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) - ? 1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) - ? 100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 : 1) - : CHECK_BTN_ANY(dpad, BTN_DLEFT) - ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) - ? -1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) - ? -100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 : -1) - : 0; + increment = CHECK_BTN_ANY(dpad, BTN_DRIGHT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? 1000 + : CHECK_BTN_ALL(input->cur.button, BTN_A) ? 100 + : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 + : 1) + : CHECK_BTN_ANY(dpad, BTN_DLEFT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? -1000 + : CHECK_BTN_ALL(input->cur.button, BTN_A) ? -100 + : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 + : -1) + : 0; gGameInfo->data[gGameInfo->regCur + regGroup] += increment; if (CHECK_BTN_ANY(dpad, BTN_DUP)) { diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index fd3edc86e..91f21648a 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -2,7 +2,7 @@ #include "vt.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS 0x00000010 +#define FLAGS ACTOR_FLAG_4 void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx); void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx); @@ -140,7 +140,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { break; case A_OBJ_UNKNOWN_6: // clang-format off - thisx->flags |= 0x1; this->dyna.bgId = 5; this->focusYoffset = 10.0f; + thisx->flags |= ACTOR_FLAG_0; this->dyna.bgId = 5; this->focusYoffset = 10.0f; // clang-format on thisx->gravity = -2.0f; EnAObj_SetupWaitTalk(this, thisx->params); @@ -154,7 +154,7 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_SIGNPOST_ARROW: thisx->textId = (this->textId & 0xFF) | 0x300; // clang-format off - thisx->flags |= 0x1 | 0x8; thisx->targetArrowOffset = 500.0f; + thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; thisx->targetArrowOffset = 500.0f; // clang-format on this->focusYoffset = 45.0f; EnAObj_SetupWaitTalk(this, thisx->params); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index ef85217cd..794a62659 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -3,7 +3,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" -#define FLAGS 0x00000000 +#define FLAGS 0 void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); @@ -1166,7 +1166,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { spawnedActor->actor.room = -1; } - spawnedActor->actor.flags |= 0x0010; + spawnedActor->actor.flags |= ACTOR_FLAG_4; } } } @@ -1198,7 +1198,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p spawnedActor->actor.speedXZ = 0.0f; spawnedActor->actor.gravity = param4000 ? 0.0f : -0.9f; spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f); - spawnedActor->actor.flags |= 0x0010; + spawnedActor->actor.flags |= ACTOR_FLAG_4; } } } @@ -1310,7 +1310,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f; Actor_SetScale(&spawnedActor->actor, 0.0f); EnItem00_SetupAction(spawnedActor, func_8001E304); - spawnedActor->actor.flags |= 0x0010; + spawnedActor->actor.flags |= ACTOR_FLAG_4; if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && (spawnedActor->actor.params != ITEM00_HEART_PIECE) && (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 3f4e11be5..0663dc6ae 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,6 +1,6 @@ #include "global.h" -#define FLAGS 0x06000035 +#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26) void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx); void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 50667d026..7392222b8 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1253,7 +1253,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_Get(&sp14C); Matrix_MtxFToYXZRotS(&sp14C, &spB8, 0); - if (hookedActor->flags & 0x20000) { + if (hookedActor->flags & ACTOR_FLAG_17) { hookedActor->world.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x; } else { hookedActor->world.rot.y = hookedActor->shape.rot.y = this->actor.shape.rot.y + this->unk_3BC.y; |
