Skip to content

MarioSwim 97%#1858

Merged
shibbo merged 7 commits intoSMGCommunity:masterfrom
alexsr1:marioswim-progress
Jan 26, 2026
Merged

MarioSwim 97%#1858
shibbo merged 7 commits intoSMGCommunity:masterfrom
alexsr1:marioswim-progress

Conversation

@alexsr1
Copy link
Copy Markdown
Contributor

@alexsr1 alexsr1 commented Jan 25, 2026

No description provided.

@decomp-dev
Copy link
Copy Markdown

decomp-dev Bot commented Jan 25, 2026

Report for RMGK01 (e5a64e4 - 734bdd0)

📈 Matched code: 40.12% (+0.20%, +10992 bytes)

✅ 5 new matches
Unit Item Bytes Before After
main/Game/Player/MarioSwim MarioSwim::update() +319 96.02% 100.00%
main/Game/Player/MarioSwim MarioSwim::start() +55 97.73% 100.00%
main/Game/Player/MarioSwim MarioSwim::addVelocity(const JGeometry::TVec3<float>&) +51 66.82% 100.00%
main/Game/Player/MarioSwim MarioSwim::calcRingAcc() +11 97.40% 100.00%
main/Game/Player/MarioModule MarioModule::playEffectTrans(const char*, const JGeometry::TVec3<float>&) +8 0.00% 100.00%
📈 12 improvements in unmatched functions
Unit Item Bytes Before After
main/Game/Player/MarioSwim MarioSwim::hitWall(const JGeometry::TVec3<float>&, HitSensor*) +2096 0.00% 97.25%
main/Game/Player/MarioSwim MarioSwim::decideVelocity() +1987 0.00% 96.12%
main/Game/Player/MarioSwim MarioSwim::close() +1604 0.00% 99.51%
main/Game/Player/MarioSwim MarioSwim::procBuoyancy() +977 0.00% 93.62%
main/Game/Player/MarioSwim MarioSwim::updateUnderWater() +36 93.55% 97.48%
main/Game/Player/MarioSwim .sdata2 +21 91.67% 97.62%
main/Game/Player/MarioSwim MarioSwim::decideAnimation() +14 97.96% 99.53%
main/Game/Player/MarioSwim .rodata +13 53.57% 86.11%
main/Game/Player/MarioSwim MarioSwim::decideEffect(bool) 0 99.73% 99.74%
main/Game/Player/MarioSwim MarioSwim::dropJet(bool) 0 99.92% 99.95%
main/Game/Player/MarioSwim MarioSwim::forceStopSpin() 0 99.88% 99.90%
main/Game/Player/MarioSwim MarioSwim::updateTilt() 0 96.12% 96.13%

@alexsr1 alexsr1 marked this pull request as ready for review January 26, 2026 00:24
Comment thread src/Game/Player/MarioSwim.cpp Outdated
#include "Game/Util/SceneUtil.hpp"
#include "JSystem/JGeometry/TVec.hpp"
#include "math_types.hpp"
#include "revolution/types.h"
#include <cstddef>

const f32 cAnimSpeeds[4] = {1.0f, 1.0f, 1.0f, 1.0f};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the explicit array size for portability.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
Comment on lines +1430 to +1431
if (mJetTimer != 0)
return;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Always include curly braces for conditional blocks, even if the underlying code is only one statement.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
MR::getWaterAreaObj(&headWaterInfo, checkPos);
if (!bodyWaterInfo.isInWater() || !headWaterInfo.isInWater()) {
return false;
if (!MR::isNearZero(_184, 0.001f)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the tolerance argument in favor of the equivalent default parameter.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
} else {
mNextAction = EXIT_ACTION_JUMP;
}
if (!MR::isNearZero(_184, 0.001f)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the tolerance argument in favor of the equivalent default parameter.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
AreaInfo* MarioSwim::getWaterAreaInfo(WaterInfo* pInfo, const TVec3f& rPos, TVec2f* pOutVec) {
AreaInfo* waterAreaInfo = MR::getWaterAreaInfo(pInfo, rPos, getPlayer()->getAirGravityVec(), false);

if (pOutVec) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prefer an explicit comparison to nullptr for pointer null checking.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
Comment on lines +2137 to +2147
if (mIsOnSurface != 0) {
_36 = 20;
_30 = 50;
_7C = 45;
_2C = 30;
} else {
_36 = mActor->getConst().getTable()->mSwimSpinFrontTime;
_30 = mActor->getConst().getTable()->mSwimSpinYspeedTime;
}

if (mIsOnSurface == 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prefer an implicit comparison to true/false for Boolean variables.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
MR::vecKillElement(velocityPart, getGravityVec(), &direction);

direction.length();
if (MR::normalizeOrZero(&direction) == 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prefer an implicit comparison to true/false for Boolean return values.

Comment thread src/Game/Player/MarioSwim.cpp Outdated
}

// Wall Push / Kick Logic check
if (rNormal.dot(getGravityVec()) > 0.80000001f) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this precision is necessary. 0.8f should suffice.

@alexsr1
Copy link
Copy Markdown
Contributor Author

alexsr1 commented Jan 26, 2026

I pushed the requested fixes

@shibbo shibbo merged commit 524b060 into SMGCommunity:master Jan 26, 2026
1 check passed
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