Skip to content
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

daMagLift_c work #2275

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

daMagLift_c work #2275

wants to merge 5 commits into from

Conversation

YunataSavior
Copy link

@YunataSavior YunataSavior commented Dec 29, 2024

The file is matching, however I still have some cleanup to do.

Most notably, I haven't named the cXyz fields, though those names should be guessable.

This is my first stab at decompilation, so please be gentle XD

Also, I forgot to remove "NONMATCHING" from many functions as of my 2nd commit.

/* 0x5ae */ u8 field_0x5ae;
/* 0x5af */ s8 field_0x5af;
/* 0x5b0 */ s16 mPoint;
// two bytes of padding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments about padding aren't that necessary

// two bytes of padding.
/* 0x5b4 */ cXyz field_0x5b4;
/* 0x5c0 */ cXyz field_0x5c0;
/* 0x5cc */ float mMoveSpeed;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f32 is preferred for float types in game code

/* 0x5cc */ float mMoveSpeed;
/* 0x5d0 */ u8 mMode;
/* 0x5d1 */ u8 is_switch;
// The rest is word padding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing about comment being unnecessary

Comment on lines 39 to 42
PSMTXTrans(mDoMtx_stack_c::get(), current.pos.x, current.pos.y, current.pos.z);
mDoMtx_ZXYrotM(mDoMtx_stack_c::get(), current.angle.x, current.angle.y, current.angle.z);
mpModel->mBaseScale = scale;
PSMTXCopy(mDoMtx_stack_c::get(), mpModel->mBaseTransformMtx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably be cleaned up with multiple inlines. I'd recommend for all functions in this TU and all future work referencing the debug rom for what inlines are used to help simplify the code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also drop the PS prefix -- we have a macro for most of these functions for better debug rom compatibility.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I accomplished hatal's comment in a local update.
  2. I changed mBaseScale to "setBaseScale()".
  3. When I try to change mpModel->mBaseTransformMtx to mpModel->getModelData(), that breaks code matching.

/* 80C8DE98-80C8DF20 000558 0088+00 1/0 0/0 0/0 .text modeAcc__11daMagLift_cFv */
void daMagLift_c::modeAcc() {
// NONMATCHING
if (1 == cLib_chaseF(&speedF, mMoveSpeed, mMoveSpeed / 30.0f) || current.pos == field_0x5b4) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would look cleaner as cLib_chaseF() == TRUE or something

Comment on lines +38 to +41
MTXTrans(mDoMtx_stack_c::get(), current.pos.x, current.pos.y, current.pos.z);
mDoMtx_ZXYrotM(mDoMtx_stack_c::get(), current.angle.x, current.angle.y, current.angle.z);
mpModel->setBaseScale(scale);
MTXCopy(mDoMtx_stack_c::get(), mpModel->mBaseTransformMtx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be

mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z);
mpModel->setBaseScale(scale);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());

}
field_0x5ae = fopAcM_GetParam(this);
dPath* path = dPath_GetRoomPath(field_0x5ae, fopAcM_GetRoomNo(this));
if (!path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isnt a major blocker or anything, personally i like explicit NULL pointer checks (path == NULL) more since its less ambiguous when reading.

init_modeMoveWait();
}
}
cullMtx = mpModel->getBaseTRMtx();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fopAcM_setCullSizeBox2here

}

/* 80C8E2C4-80C8E318 000984 0054+00 1/0 0/0 0/0 .text modeMoveWait__11daMagLift_cFv */
void daMagLift_c::modeMoveWait() {
// NONMATCHING
if (fopAcM_isSwitch(this, fopAcM_GetParamBit(this, 0xc, 8)) & 0xff) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure this is supposed to be fopAcM_GetParam rather than GetParamBit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants