Add vehicle suspension restoration and post-render handling#5011
Open
QueryOfficial wants to merge 2 commits into
Open
Add vehicle suspension restoration and post-render handling#5011QueryOfficial wants to merge 2 commits into
QueryOfficial wants to merge 2 commits into
Conversation
#### Summary Introduces a new handler for restoring vehicle suspension after the automobile pre-render phase. This includes the addition of `OnAutomobilePostPreRender` to manage suspension restoration and a corresponding static handler in `CClientGame`. The `CMultiplayerSA` class is updated to support this new functionality, ensuring that vehicle suspension data is correctly managed during rendering. #### Test plan 1. Verify that vehicle suspension is restored correctly after pre-render. 2. Test the integration of the new handler with existing vehicle rendering processes. #### Checklist * [x] Code adheres to the coding guidelines. * [x] Changes have been tested and verified.
#### Summary Updated the formatting of static variable declarations for improved readability in the `CMultiplayerSA` class. The changes align with coding standards and enhance code clarity without altering functionality. #### Checklist * [x] Code adheres to the coding guidelines. * [x] Changes have been tested and verified.
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.
Summary
Privatize suspension line data for
CAutomobile::PreRender, mirroring the existing collision hook pattern, so wheel render height is per-vehicle instead of shared per model.After the PreRender wheel block, re-apply cached
wheel_*_dummycomponent positions sosetVehicleComponentPositionZ offsets are not overwritten every frame.Motivation
Fixes #5007 and #1652.
#5007: When suspension handling is modified (
setVehicleHandling, hedit, etc.), wheels render at the wrong height as soon as another vehicle of the same model streams in or recalculates handling. Physics is correct becauseProcessVehicleCollisionalready swaps in per-vehicle private suspension lines viaCopyGlobalSuspensionLinesToPrivate, but PreRender still reads the shared per-modelCColModelsuspension lines (“last writer wins”).#1652:
setVehicleComponentPositionon wheel dummies (wheel_lf_dummy, etc.) applies X but not Z, because PreRender overwrites wheel dummy Z from suspension lines every frame.This change:
CAutomobile::PreRenderentry (0x6AAB50) to temporarily set the model’s suspension lines to the current vehicle’s private copy before wheel positioning runs.0x6ABCFDinHOOK_Vehicle_PreRender).CClientVehicle::m_ComponentData.Test plan
setVehicleHandling— wheels and body should match.setVehicleComponentPosition(veh, "wheel_lf_dummy", x+1, y, z+10)— both X and Z offsets should be visible and stable while driving.Environment tested: MTA:SA client (Windows), local + remote client scenario.
Checklist