Skip to content

Correct float rounding and vector calculations - #213

Merged
Mrkol merged 8 commits into
doldecomp:mainfrom
KakarottoCake:vecmath-cleanup
Oct 4, 2026
Merged

Mrkol merged 8 commits into
doldecomp:mainfrom
KakarottoCake:vecmath-cleanup

Conversation

@KakarottoCake

@KakarottoCake KakarottoCake commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Correct parameter reads, vector components and float operation order against the retail disassembly.
Use CLBDegToShortAngle for cube rotations, put Tongue's matrix basis vectors in columns, and correct the Mare walls' Z translations.
Correct swimming turn-speed calculation and smoke position, Gesso's sight-angle calculation and double-attack range, Hinokuri's head-height parameter, and MapObjGeneral's appearance condition.
Manta's distance check keeps main's distance inline; bossManta.cpp is no longer changed by this PR.

Rebased on main at eadd711.
Compared with that revision: 16 functions improve, none regress, and matched data increases by 112 bytes.
The GMSJ01 full build, all eight symbol checks against built main objects, review-lint and whole-tree clang-format pass locally.
Both formatting repairs are already on main; this PR changes eight game source files and no middleware files.
Both GMSJ01 and GMSP01 CI builds, symbol checks and formatting pass at 6f92035.

@decomp-dev

decomp-dev Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Report for GMSJ01 (eadd711 - 6f92035)

📈 Matched data: 77.09% (+0.02%, +112 bytes)

✅ 1 new match
Unit Item Bytes Before After
mario/Enemy/Amenbo .sdata2 +5 96.40% 100.00%
📈 16 improvements in unmatched items
Unit Item Bytes Before After
mario/Enemy/bossgesso TBossGesso::moveObject() +21 71.85% 73.04%
mario/Enemy/bossgesso TBossGesso::doAttackUnison() +18 97.23% 99.73%
mario/Player/MarioSwim TMario::doSwimming() +17 98.03% 99.92%
mario/Enemy/bossgesso TBossGesso::doAttackDouble() +17 96.33% 98.82%
mario/Enemy/bossgesso TBossGesso::doAttackSkipRope() +17 96.24% 99.85%
mario/Enemy/bossgesso TBossGesso::doAttackShoot() +17 96.27% 99.56%
mario/Map/MapEventMare TMareEventBumpyWall::bumpDownZ() +13 94.87% 98.62%
mario/Enemy/bossgesso TBossGesso::doAttackSingle() +11 36.73% 37.13%
mario/Player/Tongue TYoshiTongue::calcAnim(float(*)[4]) +9 96.62% 98.01%
mario/Map/MapEventMare TMareEventBumpyWall::bumpUpZ() +9 96.06% 98.56%
mario/Enemy/Amenbo TNerveAmenboTurn::execute(TSpineBase<TLiveActor>*) const +8 98.86% 99.88%
mario/Map/MapEventMare TMareEventBumpyWall::bumpDownX() +4 97.40% 98.64%
mario/Camera/cameralib CLBIsPointInCube(const Vec&, const Vec&, const Vec&, const Vec&) +2 98.46% 98.94%
mario/Camera/cameralib CLBCalcPointInCubeRatio(const Vec&, const Vec&, const Vec&, const Vec&, float*, float*, float*) +2 98.37% 98.88%
mario/MoveBG/MapObjGeneral TMapObjGeneral::waitingToAppear() +1 98.99% 99.22%
mario/Enemy/hinokuri2 THinokuri2::moveObject() 0 99.85% 99.87%

Report for GMSP01 (eadd711 - 6f92035)

📈 Matched data: 67.99% (+0.02%, +112 bytes)

✅ 1 new match
Unit Item Bytes Before After
mario/Enemy/Amenbo .sdata2 +5 96.40% 100.00%
📈 15 improvements in unmatched items
Unit Item Bytes Before After
mario/Enemy/bossgesso TBossGesso::moveObject() +21 71.85% 73.04%
mario/Enemy/bossgesso TBossGesso::doAttackUnison() +18 97.23% 99.73%
mario/Enemy/bossgesso TBossGesso::doAttackDouble() +17 96.33% 98.82%
mario/Enemy/bossgesso TBossGesso::doAttackSkipRope() +17 96.24% 99.85%
mario/Enemy/bossgesso TBossGesso::doAttackShoot() +17 96.27% 99.56%
mario/Player/MarioSwim TMario::doSwimming() +17 98.03% 99.92%
mario/Map/MapEventMare TMareEventBumpyWall::bumpDownZ() +13 94.87% 98.62%
mario/Enemy/bossgesso TBossGesso::doAttackSingle() +11 36.73% 37.13%
mario/Map/MapEventMare TMareEventBumpyWall::bumpUpZ() +9 96.06% 98.56%
mario/Player/Tongue TYoshiTongue::calcAnim(float(*)[4]) +9 96.62% 98.01%
mario/Enemy/Amenbo TNerveAmenboTurn::execute(TSpineBase<TLiveActor>*) const +8 98.86% 99.88%
mario/Map/MapEventMare TMareEventBumpyWall::bumpDownX() +4 97.40% 98.64%
mario/Camera/cameralib CLBIsPointInCube(const Vec&, const Vec&, const Vec&, const Vec&) +2 98.46% 98.94%
mario/Camera/cameralib CLBCalcPointInCubeRatio(const Vec&, const Vec&, const Vec&, const Vec&, float*, float*, float*) +2 98.37% 98.88%
mario/MoveBG/MapObjGeneral TMapObjGeneral::waitingToAppear() +1 98.99% 99.22%

Comment thread src/Enemy/bossManta.cpp Outdated
KakarottoCake and others added 8 commits October 2, 2026 19:23
…ortAngle

CLBIsPointInCube and CLBCalcPointInCubeRatio spelled out
CLBRoundf<s16>(DEG2SHORTANGLE(x)) six times, which is the existing
CLBDegToShortAngle helper. CLBCalcPointInCubeRatio 98.37% -> 98.88%,
CLBIsPointInCube 98.46% -> 98.94%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding

Retail multiplies the BCK frame by a 1/63 constant (fmuls), where we
divided (fdivs). TNerveAmenboTurn::execute 98.86% -> 99.88%, and the
constant @2942 in .rodata now matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moveObject set the head's damage height from mSLBodyScale (+0x130).
Retail reads +0x20c, which is mSLHeadHitH, the same way the line above
reads mSLHeadHitR for the radius. THinokuri2::moveObject 99.85% ->
99.87%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comparison was inverted: the object reappeared while Mario was
inside its damage radius. Retail (fcmpo dist, sum; ble skip) calls
appear() only when the distance is greater than the radius sum.
TMapObjGeneral::waitingToAppear 98.99% -> 99.22%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retail stores the cross product, up vector, and tongue direction as matrix columns. calcAnim stored them as rows. TYoshiTongue::calcAnim: 96.62 -> 98.01.
Multiply velocity by the rotation-speed range before scaling by 1/32, as retail does. Bind the sea-smoke particle to mFootprintPos (+0x1a8), rather than unk1B4. TMario::doSwimming: 98.03 -> 99.92.
The Z wall movements initialized the X component of the translation. Use the Z component. Reuse the negated limit in the downward X and Z clamps, as retail does. bumpDownX: 97.40 -> 98.64; bumpDownZ: 94.87 -> 98.62; bumpUpZ: 96.06 -> 98.56.
Retail halves the sight angle after computing the bearing difference. Move the half-angle calculation into inSightAngle and pass the full angle from each caller. doAttackDouble also reads mSLDoubleAttackLen (+0x20c), rather than mSLUnisonAttackLen (+0x220). Six functions improve; no function regresses.
@Mrkol
Mrkol merged commit 4c3bf23 into doldecomp:main Oct 4, 2026
3 checks 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.

2 participants