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

Library/MapObj: Implement ConveyerStep #208

Merged
merged 5 commits into from
Dec 23, 2024

Conversation

Fuzzy2319
Copy link
Contributor

@Fuzzy2319 Fuzzy2319 commented Dec 10, 2024

This PR adds ConveyerStep functions.


This change is Reviewable

Copy link
Owner

@MonsterDruide1 MonsterDruide1 left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Fuzzy2319)


lib/al/Library/MapObj/ConveyerStep.cpp line 56 at r1 (raw file):

__attribute__((noinline)) void ConveyerStep::setTransByCoord(f32 coord, bool isBackwards,
                                                             bool isForceReset) {

Suggestion:

void ConveyerStep::setTransByCoord(f32 coord, bool isBackwards, bool isForceReset) {

lib/al/Library/MapObj/ConveyerStep.cpp line 84 at r1 (raw file):

    if ((isBackwards && newCoord < mCurrentCoord) || (!isBackwards && newCoord > mCurrentCoord) ||
        isForceReset)
        resetPosition(this);

I'm not sure if the isBackwards name is a good match for the logic here? Should it always resetPosition when moving in the "right" direction?

Code quote:

    if ((isBackwards && newCoord < mCurrentCoord) || (!isBackwards && newCoord > mCurrentCoord) ||
        isForceReset)
        resetPosition(this);

lib/al/Library/MapObj/ConveyerStep.h line 18 at r1 (raw file):

    void setConveyerKeyKeeper(const ConveyerKeyKeeper* conveyerKeyKeeper, f32 coord);
    void setTransByCoord(f32 coord, bool isBackwards);
    __attribute__((noinline)) void setTransByCoord(f32 coord, bool isBackwards, bool isForceReset);

Should not be necessary, because the function is large enough to not be inlined by default

Suggestion:

void setTransByCoord(f32 coord, bool isBackwards, bool isForceReset);

lib/al/Library/MapObj/ConveyerStep.h line 29 at r1 (raw file):

    const char* mActionName = nullptr;
    f32 mCurrentCoord = 0.0f;
    f32 mInitialCoord = 0.0f;

Suggestion:

f32 mMaxCoord = 0.0f;

Copy link
Contributor Author

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @MonsterDruide1)


lib/al/Library/MapObj/ConveyerStep.h line 18 at r1 (raw file):

Previously, MonsterDruide1 wrote…

Should not be necessary, because the function is large enough to not be inlined by default

Done.


lib/al/Library/MapObj/ConveyerStep.cpp line 84 at r1 (raw file):

Previously, MonsterDruide1 wrote…

I'm not sure if the isBackwards name is a good match for the logic here? Should it always resetPosition when moving in the "right" direction?

Yes, I've inverted the comparison. I read mMoveSpeed <= 0.0f instead of mMoveSpeed >= 0.0f

image.png

Done.


lib/al/Library/MapObj/ConveyerStep.cpp line 56 at r1 (raw file):

__attribute__((noinline)) void ConveyerStep::setTransByCoord(f32 coord, bool isBackwards,
                                                             bool isForceReset) {

Done.


lib/al/Library/MapObj/ConveyerStep.h line 29 at r1 (raw file):

    const char* mActionName = nullptr;
    f32 mCurrentCoord = 0.0f;
    f32 mInitialCoord = 0.0f;

Done.

Copy link
Owner

@MonsterDruide1 MonsterDruide1 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Fuzzy2319)

@MonsterDruide1 MonsterDruide1 merged commit 3ce71f1 into MonsterDruide1:master Dec 23, 2024
6 checks passed
@Fuzzy2319 Fuzzy2319 deleted the ConveyerStep branch December 23, 2024 15:51
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.

2 participants