Refactor wwmath and fix issues in weapon and EulerAnglesClass - #7
Draft
Okladnoj wants to merge 5 commits into
Draft
Refactor wwmath and fix issues in weapon and EulerAnglesClass#7Okladnoj wants to merge 5 commits into
Okladnoj wants to merge 5 commits into
Conversation
…wrappers These five _Legacy wrappers are bit-identical to their non-Legacy siblings in every math mode (verified exhaustively and independently), so route all callers to the siblings and drop the wrappers. Force float binding where a call site passed a double literal or double expression, to keep the original single-precision behaviour and avoid selecting the true-double overload. Kept: Fabsf/Sinf/Cosf/Inv_Sqrt _Legacy, which differ under retail (x87 asm, bit twiddle, NaN handling) and must stay to preserve RETAIL_COMPATIBLE_CRC.
Matrix3D elements are float, so passing double sy/cy to WWMath::Atan2 produced mixed (double, float) argument lists that matched neither the float nor the double overload after the _Legacy wrappers were removed in 3860582, causing error C2666.
…_MATH Forcing m_dieOnDetonate for SupW_AuroraFuelBombWeapon changes weapon behaviour and desyncs the retail 1.04 replays under RETAIL_COMPATIBLE_CRC=1. The fix is only needed for cross-platform determinism, so gate it on USE_DETERMINISTIC_MATH (active only when retail compatibility is disabled).
…loat TheSuperHackers @refactor Okladnoj Sqrt(int) collapsed to the same numeric result as Sqrt(float): in DET it already truncated the argument to float (gm_sqrtf((float)x)); in RETAIL it returned (float)sqrt((double)x). After removal an int argument would be ambiguous between Sqrt(float)/Sqrt(double), so the pathfinding call sites in AIPathfind (Int dx,dy cell deltas) get an explicit (float) cast. This preserves CRC bit-for-bit in both modes: DET is identical, RETAIL is identical because the int magnitudes (dx*dx+dy*dy of cell coordinates) are far below 2^24 and thus exactly representable in float.
TheSuperHackers @refactor Okladnoj Finish the constant-only WWMath conversion in W3DMouse::draw() (WWMATH_HALF_PI) by also routing the scroll-cursor angle through WWMath::Atan2 instead of the raw libm atan2, per review consensus (either all operations through WWMath or revert the constant). Cursor rendering is not part of the simulation CRC.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Math Refactoring
The refactoring is still in progress. This PR contains only math refactoring changes recommended by @bobtista and @Caball009 in their reviews.
This PR is a sub-part of the fundamental milestone tracked in TheSuperHackers#2670, where the final deterministic math implementation is waiting for its time.
To verify
RETAIL=1compatibility, I use my own workflow that runs retail replays—the golden set—in VC6 mode.To verify deterministic math support, I use the
1x1x2x2x2_mac_win_3.repreplay (118,800 frames), running it simultaneously on macOS and Windows.The math refactoring is still ongoing.
1x1x2x2x2_mac_win_3.rep.zip