-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
d_a_e_ym (a.k.a. Twilight bugs) 99% equivalent (daE_YM_c::checkBeforeBg and daE_YM_c::create have regalloc issues) #2311
base: main
Are you sure you want to change the base?
Conversation
…c issues. Cleanup of mSound funcs in d_a_e_ym.
@@ -28,7 +28,7 @@ class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo { | |||
void ct(); | |||
void Set2(const cXyz*, const cXyz*, unsigned int); | |||
void PreCalc(); | |||
void GetCross(); | |||
cXyz* GetCross() { return &mLin.GetEnd(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should return a reference, and you can remove the i_GetCross fake. be sure you've ensured no regressions by comparing a diff report before this change and after.
int action = mAction; | ||
if (action != ACT_WAIT && action != ACT_MOVE && action != ACT_SURPRISE && action != ACT_ATTACK && action != ACT_ATTACK_WALL) { | ||
return 0; | ||
} | ||
if (field_0x6f6 != 0) { | ||
return 0; | ||
} | ||
int val = field_0x6fc; | ||
if (val != 0) { | ||
return 0; | ||
} | ||
if (action != 8) { | ||
bool truth = dComIfGp_getAttention().LockonTruth(); | ||
if (truth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are some of these temp's necessary? they seem like they can be removed at a glance, but check if it affects regalloc
if (mAcch.ChkGroundHit() == 0) { | ||
return 0; | ||
} | ||
f32 my_val; | ||
if (mType == 4) { | ||
my_val = l_HIO.mSurpriseDistance + 200.0f; | ||
} else { | ||
if (field_0x6a9 != 0) { | ||
my_val = l_HIO.mSurpriseDistance; | ||
} else { | ||
my_val = l_HIO.mSurpriseDistance + 200.0f; | ||
} | ||
} | ||
if (mDistToPlayer < my_val) { | ||
if (mSphCc.ChkCoHit()) { | ||
cCcD_Obj* hit_obj = mSphCc.GetCoHitObj(); | ||
fopAc_ac_c* my_ac = dCc_GetAc(hit_obj->GetAc()); | ||
if (fopAcM_GetName(my_ac) == PROC_ALINK) { | ||
if (mType == 4) { | ||
return checkRailSurprise(); | ||
} | ||
if (mTagPosP != NULL) { | ||
setActionMode(ACT_FLY); | ||
} else { | ||
setActionMode(ACT_SURPRISE); | ||
} | ||
return 1; | ||
} | ||
} | ||
if (mAction == ACT_ATTACK) { | ||
return 0; | ||
} | ||
if (player->getSpeedF() >= 16.0f) { | ||
field_0x6f6 = 0; | ||
} else { | ||
if (field_0x6f8) { | ||
return 0; | ||
} | ||
if (mDistToPlayer > l_HIO.mSurpriseDistance - 100.0f) { | ||
field_0x6f8 = 0x3c; | ||
return 0; | ||
} | ||
} | ||
if (field_0x6f6 == 0) { | ||
if (mType == 4) { | ||
return checkRailSurprise(); | ||
} | ||
if (mTagPosP != NULL) { | ||
setActionMode(ACT_FLY); | ||
} else { | ||
setActionMode(ACT_SURPRISE); | ||
} | ||
return 1; | ||
} | ||
} else { | ||
field_0x6f8 = 0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a minor style thing but i prefer separating unrelated if statement blocks with an empty line to increase readability.
if () {
} else {
}
// empty line
if () {
// . . .
if (player->checkWolfDig()) { | ||
my_vec_0 = player->getLeftHandPos() - current.pos; | ||
if (my_vec_0.abs() < 200.0f) { | ||
field_0x714 &= 0xffffff7f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these can usually be simplified to something like &= ~0x80
// NONMATCHING | ||
daPy_py_c* player = daPy_getPlayerActorClass(); | ||
cXyz player_pos = player->current.pos; | ||
attention_info.distances[2] = '<'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like a ghidra-ism, should be a numerical value rather than a character
// NONMATCHING | ||
if (mFlyType == 1) { | ||
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("E_TM", 0x11); | ||
JUT_ASSERT(model_data != NULL, 0x1094); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these asserts are backwards, its line number first and then the assert condition. additionally, the way the condition is written does actually matter for matching debug and so should match the debug rom's string exactly. modelData != 0
. variable should be renamed accordingly
} | ||
} | ||
if (mType == 6) { | ||
field_0x6d0 = new cXyz[0x2d]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting this here but it applies generally, i like to use decimal in most places unless hex makes more sense (angles, values that come out to a clean number in hex, resource IDs for things like particles, etc)
No description provided.