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

d_a_msw #662

Merged
merged 15 commits into from
Jun 27, 2024
Merged

d_a_msw #662

merged 15 commits into from
Jun 27, 2024

Conversation

DanTGL
Copy link
Collaborator

@DanTGL DanTGL commented Jun 26, 2024

#125

Mostly matching except for regalloc issue in daMsw_Execute

@@ -2,10 +2,31 @@
#define D_A_MSW_H

#include "f_op/f_op_actor.h"
#include "SSystem/SComponent/c_phase.h"
#include "d/d_bg_w.h"
#include "d/d_cc_d.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since dBgW is only used as a pointer, you can forward-declare it in the header.

class dBgW;

angle1 = -cM_atan2s(tmp.y, tmp.z);

// TODO: std::sqrtf(float)
angle2 = cM_atan2s(tmp.x, sqrtf(tmp.y * tmp.y + tmp.z * tmp.z));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the sqrtf not just tmp.absXZ()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not in the debug map.

I'm pretty sure that d_a_msw was written very early in development.

Copy link
Collaborator

Choose a reason for hiding this comment

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

absXZ calls VECSquareMag so it wouldn't match anyway.
I think the team that did the C-style actors never used absXZ since I've seen this sqrtf(x*x + z*z) written out manually a lot in them (maybe a macro?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

absXZ calls VECSquareMag so it wouldn't match anyway. I think the team that did the C-style actors never used absXZ since I've seen this sqrtf(x*x + z*z) written out manually a lot in them (maybe a macro?)

I find it unlikely that they used a macro since there's not really any benefit to using macros for that.

Copy link
Collaborator Author

@DanTGL DanTGL Jun 27, 2024

Choose a reason for hiding this comment

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

And it doesn't really matter in this case. All three of us have apparently misread the code.

i_this->m298 += 1;

// WTH?
// Branchless comparison
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably something #ifdef'd out for debug

Copy link
Collaborator

Choose a reason for hiding this comment

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

other than a switch statement, another way to get MWCC to generate a branchless comparison is with this trick using a self-assign on any float member variable that gets optimized out:

    if (i_this->m29A == 0) {
        i_this->speedF = i_this->speedF;
    }

but without knowing what i_this->m29A there's no way to know what they actually wrote

@LagoLunatic LagoLunatic merged commit 300d820 into zeldaret:main Jun 27, 2024
3 checks passed
@DanTGL DanTGL deleted the d_a_msw branch June 27, 2024 17:41
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