bugfix: Restore Generals retail compatibility after change to ParticleUplinkCannonUpdate::update reordered floating-point operations - #3365
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughBoth game variants now use an explicit floating-point operation order for automated target distance in retail-compatible CRC builds. Other builds retain ChangesParticle uplink cannon update
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change aims to restore Generals replay compatibility by changing the distance calculation’s operation order. The available evidence does not confirm whether VC6 emits that order, but it also does not establish a remaining replay mismatch or another actionable merge-blocking issue. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
…eUplinkCannonUpdate::update reordered floating-point operations.
33c1104 to
f777a0b
Compare
It appears that the VC6 compiler is extremely sensitive to changing around floating point operations in
ParticleUplinkCannonUpdate::update.Currently the instructions for
Real targetDistance = buildingToInitialTargetVector.length()are equal tosqrt(z*z + x*x + y*y)left to right. The Steam binary doessqrt(x*x + y*y + z*z)left to right, and the change in this PR restores the exact code that the Steam binary uses. See issue for code generation comparisons.The reason I used this solution is because I found that with other approaches VC6 would not actually generate the correct code, or it would change too much.
I removed the old comment for
isFiringbecause it's no longer accurate (neither for GEN or ZH). The compiler currently generates the same code for both versions. It's not clear to me if the comment refers to the exact same problem that this PR aims to address.Zero Hour already generates the correct code here, so I put this behind the
RTS_GENERALSmacro.TODO: