Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][TM2020] VehicleState::GetVis can return the wrong CSceneVehicleVis #13

Open
AmazingBeu opened this issue Jan 3, 2024 · 6 comments

Comments

@AmazingBeu
Copy link

In TM2020, if you open the Debug Window in the "Player States", you will see that players can have the same VehicleState values.

Note that the VehicleState::GetAllVis function works well (as you can see in the "All state" tab)

@AmazingBeu
Copy link
Author

after investigating a bit, VehicleState::GetPlayerVehicleID can't find the VehicleId and returns 0 except for myself

@AmazingBeu
Copy link
Author

Looks like 0x20 is 0x14 now here: https://github.com/openplanet-nl/vehiclestate/blob/3f57bdf0901e70be5e9cfd134f4d0f468edee6bd/Internal/Vehicle/VehicleNext.as#L30C98-L30C98

Tested with the 2023-12-20 update. Do you want i open a pull request for 2 characters? 😅

@codecat
Copy link
Member

codecat commented Jan 4, 2024

Thanks! I'm taking a look now.

@codecat
Copy link
Member

codecat commented Jan 4, 2024

Looks like this was changed in #2 by @Xandaros (see commit 1e0d97e).

Perhaps this change is no longer valid, or I verified it wrong? Not sure, but a negative offset of 0x14 does seem to give the correct ID.

codecat added a commit that referenced this issue Jan 4, 2024
@Xandaros
Copy link
Contributor

Xandaros commented Jan 5, 2024

Is this just going to be a recurring thing, where the offset changes every now and again? I can tell you that we had this exact issue with 0x14 and 0x20 fixed it.

I haven't played in a while, so never noticed anything breaking, but I'm assuming the magic number just changed again and broke things. Maybe nadeo undid their change there and so we are back to the old offset? I have no idea.

Either way, if there are issues with the vehicle state, at least we know where to look.

@codecat
Copy link
Member

codecat commented Jan 5, 2024

Perhaps. It could also be that it's a buffer of vehicle ID's, as there are more than 1 in that range already, and we have to read the "first" in the buffer. At negative 0x20 for example there is often just 0.

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

No branches or pull requests

3 participants