Use cLib on/off bit inlines for attn flags

The debug maps indicate these inlines were pretty much always used when these flags are ORed or ANDed (but not when checked or set).
This commit is contained in:
LagoLunatic
2025-03-08 17:08:50 -05:00
parent e696d982c6
commit 87dcddd519
13 changed files with 33 additions and 34 deletions
-1
View File
@@ -923,7 +923,6 @@ bool cM3d_CrossY_Tri(const Vec& r3, const Vec& r4, const Vec& r5, const cM3dGPla
/* 8024C370-8024C4D0 .text cM3d_CrossY_Tri_Front__FRC3VecRC3VecRC3VecPC3Vec */
bool cM3d_CrossY_Tri_Front(const Vec& r3, const Vec& r4, const Vec& r5, const Vec* pos) {
/* Nonmatching - regalloc */
if (!cM3d_InclusionCheckPosIn3PosBox2d(
r3.z,
r3.x,
+3 -3
View File
@@ -125,7 +125,7 @@ BOOL enemy_ice(enemyice* ei) {
ac->tevStr.mFogStartZ = 0.0f;
ac->tevStr.mFogEndZ = 2000.0f;
fopAcM_seStart(ac, JA_SE_CM_L_ARROW_SHRINK, 0);
ac->attention_info.flags &= ~fopAc_Attn_LOCKON_BATTLE_e;
cLib_offBit<u32>(ac->attention_info.flags, fopAc_Attn_LOCKON_BATTLE_e);
} else {
ei->mLightShrinkTimer++;
@@ -225,10 +225,10 @@ BOOL enemy_ice(enemyice* ei) {
frozen = TRUE;
moveAndCollide = TRUE;
if (ei->m00C != 1) {
ac->attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(ac->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
ac->attention_info.distances[fopAc_Attn_TYPE_CARRY_e] = 0x12;
if (fopAcM_CheckStatus(ac, fopAcStts_CARRY_e)) {
ac->attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(ac->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
ei->mState = 3;
if (ei->m00C == 2) {
ei->m00C = 0;
+4 -4
View File
@@ -646,7 +646,7 @@ static void action_mahi(am2_class* i_this) {
break;
case 0xC:
if (i_this->mCountDownTimers[3] == 0 || i_this->mCountDownTimers[3] > 3) {
actor->attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
if (naraku_check(i_this)) {
if (i_this->mbNotInHomeRoom) {
@@ -785,7 +785,7 @@ static void action_mahi(am2_class* i_this) {
if (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e)) {
fopAcM_cancelCarryNow(actor);
actor->attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
actor->gravity = -4.0f;
actor->speed.y = 20.0f;
}
@@ -797,7 +797,7 @@ static void action_mahi(am2_class* i_this) {
if (i_this->mCurrBckIdx != AM2_BCK_BURUBURU) {
anm_init(i_this, AM2_BCK_BURUBURU, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1);
i_this->mCountDownTimers[3] = 20*30;
actor->attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
fopAcM_seStart(i_this, JA_SE_CM_AM2_RECOVER, 0);
fopAcM_monsSeStart(actor, JA_SE_CV_AM2_AWAKE, 0);
}
@@ -805,7 +805,7 @@ static void action_mahi(am2_class* i_this) {
if (i_this->mCountDownTimers[3] == 1) {
if (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e)) {
fopAcM_cancelCarryNow(actor);
actor->attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e);
actor->gravity = -4.0f;
+2 -2
View File
@@ -957,11 +957,11 @@ namespace daBomb2 {
}
void Act_c::on_carry() {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
void Act_c::off_carry() {
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
void Act_c::mode_wait_init() {
+5 -5
View File
@@ -822,7 +822,7 @@ int daBomb_c::procExplode_init() {
change_state(STATE_0);
}
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
if(field_0x6F0) {
daPy_getPlayerLinkActorClass()->decrementBombCnt();
@@ -927,7 +927,7 @@ bool daBomb_c::procCarry_init() {
change_state(STATE_2);
speedF = 0.0f;
speed.set(cXyz::Zero);
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
mSph.OffCoSPrmBit(cCcD_CoSPrm_Set_e);
return true;
@@ -1001,10 +1001,10 @@ bool daBomb_c::procWait() {
if(!temp && !field_0x781) {
bound(y_vel);
if((mAcch.ChkGroundHit() || chk_state(STATE_5)) && !mAcch.ChkGroundLanding()) {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
else {
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
}
@@ -1420,7 +1420,7 @@ void daBomb_c::create_init() {
mRestTime = 0x96;
mInitialState = prm_get_state();
if(!chk_state(STATE_4)) {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
field_0x77C = 0;
+1 -1
View File
@@ -716,7 +716,7 @@ void daStandItem_c::execAction() {
void daStandItem_c::mode_carry_init() {
fopAcM_SetSpeedF(this, 0.0f);
speed = cXyz::Zero;
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
mCyl.OffCoSetBit();
mMode = MODE_CARRY;
}
+2 -2
View File
@@ -623,10 +623,10 @@ int daNpc_kam_c::waitNpcAction(void*) {
mC0C = cLib_getRndValue(10, 80);
} else if (mActionStatus != ACTION_ENDING) {
if (changeAreaCheck()) {
attention_info.flags |= fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_NOTALK_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_NOTALK_e);
mEventState = 6;
} else {
attention_info.flags &= ~(fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_NOTALK_e);
cLib_offBit<u32>(attention_info.flags, (fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_NOTALK_e));
mEventState = -1;
}
+7 -7
View File
@@ -1291,7 +1291,7 @@ BOOL daNpc_Md_c::chkAdanmaeDemoOrder() {
/* 000043D4-00004B04 .text waitNpcAction__10daNpc_Md_cFPv */
BOOL daNpc_Md_c::waitNpcAction(void*) {
if (mActionStatus == ACTION_STARTING) {
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
if (isTypeSea()) {
if (m3104 == 0x1E || m3104 == 0x29 || m312D == 0xE || m312D == 0x12 || m312D == 0x13 || m312D == 0x1A || m312D == 0x25) {
setHarpPlayNum(1);
@@ -1351,19 +1351,19 @@ BOOL daNpc_Md_c::waitNpcAction(void*) {
}
} else {
s16 headAngle = shape_angle.y + mJntCtrl.getHead_y() + mJntCtrl.getBackbone_y();
attention_info.flags &= ~(fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e);
cLib_offBit<u32>(attention_info.flags, (fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e));
m312C = chkAttention(current.pos, headAngle, 1);
sp08 = m312C;
if (sp08 != 0) {
if (isTypeAtorizk() || isTypeAdanmae() || isTypeSea()) {
attention_info.flags |= fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e);
}
if (isTypeAtorizk() || isTypeAdanmae()) {
mCurEventMode = 2;
} else if (isTypeM_Dra09()) {
if (dComIfGs_isEventBit(0x1140)) {
if (dComIfGs_isEventBit(0x1101)) {
attention_info.flags |= fopAc_Attn_ACTION_SPEAK_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_SPEAK_e);
if (dComIfGp_checkPlayerStatus0(0, daPyStts0_UNK800000_e)) {
dComIfGs_onEventBit(0x1280);
}
@@ -1373,7 +1373,7 @@ BOOL daNpc_Md_c::waitNpcAction(void*) {
mCurEventMode = 1;
}
} else {
attention_info.flags |= fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e);
mCurEventMode = 2;
}
} else {
@@ -1384,7 +1384,7 @@ BOOL daNpc_Md_c::waitNpcAction(void*) {
mCurEventMode = 3;
}
} else {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
}
}
NpcCall(&sp08);
@@ -1611,7 +1611,7 @@ BOOL daNpc_Md_c::hitNpcAction(void* r29) {
current.angle.y = angle;
speedF = 10.0f;
speed.y = 20.0f;
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
mAcchCir[1].SetWall(60.0f, 20.0f);
clearStatus(daMdStts_UNK1 | daMdStts_UNK4);
setBitStatus(daMdStts_UNK2);
+5 -5
View File
@@ -694,7 +694,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) {
}
}
else {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
s16 angle = shape_angle.y + mJntCtrl.getHead_y() + mJntCtrl.getBackbone_y();
field_0x7A4 = chkAttention(current.pos, angle);
@@ -709,7 +709,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) {
}
}
attention_info.flags &= ~(fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e);
cLib_offBit<u32>(attention_info.flags, (fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e));
f32 dist = fopAcM_searchPlayerDistance2(this);
if(!checkNpcCallCommand()) {
@@ -800,7 +800,7 @@ BOOL daNpc_Os_c::talkNpcAction(void*) {
if(field_0x7A9 == 0) {
l_msgId = -1;
field_0x780 = getMsg();
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
field_0x7A3 = 0;
field_0x7A9 += 1;
}
@@ -837,7 +837,7 @@ BOOL daNpc_Os_c::carryNpcAction(void* param_1) {
if(field_0x7A9 == 0) {
setAnm(0);
attention_info.flags &= ~fopAc_Attn_ACTION_CARRY_e;
cLib_offBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
offNpcCallCommand();
field_0x7AC = shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y;
field_0x788 = 120.0f;
@@ -1052,7 +1052,7 @@ BOOL daNpc_Os_c::routeCheck(f32 param_1, s16* param_2) {
/* 0000375C-000039EC .text searchNpcAction__10daNpc_Os_cFPv */
BOOL daNpc_Os_c::searchNpcAction(void*) {
if(field_0x7A9 == 0) {
attention_info.flags |= fopAc_Attn_ACTION_CARRY_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_CARRY_e);
setAnm(1);
field_0x7A9 += 1;
+1 -1
View File
@@ -270,7 +270,7 @@ int daObjMknjD::Act_c::Create() {
attention_info.distances[fopAc_Attn_TYPE_TALK_e] = 0x3D;
attention_info.distances[fopAc_Attn_TYPE_SPEAK_e] = 0x3D;
attention_info.flags |= fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_CHECK_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_CHECK_e);
if (!checkItemGet(mGiveItemNo, 1)) {
m043F = 8;
+1 -1
View File
@@ -153,7 +153,7 @@ namespace daObjPaper {
attention_info.position.y += attr(mType).mAttentionOffset;
attention_info.distances[fopAc_Attn_TYPE_TALK_e] = attr(mType).mAttentionDist1;
attention_info.distances[fopAc_Attn_TYPE_SPEAK_e] = attr(mType).mAttentionDist2;
attention_info.flags |= fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_READ_e;
cLib_onBit<u32>(attention_info.flags, fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_READ_e);
mMsgId = fpcM_ERROR_PROCESS_ID_e;
+1 -1
View File
@@ -427,7 +427,7 @@ f32 dAttention_c::EnemyDistance(fopAc_ac_c* actor) {
if (fopAcM_GetProfName(actor) == PROC_PLAYER)
return -1.0f;
if (!(actor->attention_info.flags & 4) && !(actor->attention_info.flags & 0x4000000))
if (!(actor->attention_info.flags & fopAc_Attn_LOCKON_BATTLE_e) && !(actor->attention_info.flags & fopAc_Attn_ENEMYFLAG_NOLOCKON_e))
return -1.0f;
f32 dist = fopAcM_searchActorDistance(actor, mpPlayer);
+1 -1
View File
@@ -1522,7 +1522,7 @@ void mDoExt_McaMorf2::ERROR_EXIT() {
/* 80013770-80013E50 .text calc__15mDoExt_McaMorf2FUs */
void mDoExt_McaMorf2::calc(u16 param_0) {
/* Nonmatching - regalloc (fixing the regalloc causes an instruction swap on f30 = field_0x84) */
/* Nonmatching - regalloc (fixing the regalloc causes an instruction swap on f30 = mAnmRate) */
if (!mpModel) {
return;
}