mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Fix setVehicleDirtLevel

Open Haxardous opened this issue 2 years ago • 8 comments

Describe the bug

https://wiki.multitheftauto.com/wiki/SetVehicleDirtLevel

Function has been disabled. Reason/Note: This function doesn't work actually. See the bugtracker for updates and more information.

Steps to reproduce

setVehicleDirtLevel (theVehicle, 100)

Version

Client: Multi Theft Auto v1.6-release-22279

Additional context

No response

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

Haxardous avatar Nov 02 '23 21:11 Haxardous

Sadly, this function wont ever work without making our own implementation. Accrding to the gta wiki:

When accumulated dirt was introduced on vehicles in Grand Theft Auto: San Andreas, car washes were believed to be featured, but the feature was never included in the final version of the game

Thus we cannot call any gta function that sets the dirt level because such function doesn't exist. Maybe CVehicleModelInfo::SetDirtTextures might do something but its unlikely anything will happen.

Maybe the dirt level can be recreated via textures?

TracerDS avatar Aug 08 '24 11:08 TracerDS

Are you sure? Vehicles is SA can be dirty, but the game doesn't provide a way to clean them GTA SA 1.01 and silent path fix that.

video

TheNormalnij avatar Aug 08 '24 18:08 TheNormalnij

Are you sure? Vehicles is SA can be dirty, but the game doesn't provide a way to clean them GTA SA 1.01 and silent path fix that.

video

With silent patch, yes. I looked over gta mem addresses but I didnt find any function that referenced or changed dirt level in any way.

TracerDS avatar Aug 08 '24 18:08 TracerDS

gta-reversed has some related to dirt level code. There are documented and reversed functions.

TheNormalnij avatar Aug 08 '24 22:08 TheNormalnij

gta-reversed has some related to dirt level code. There are documented and reversed functions.

No. The only functions related to dirt level are constructors for dirt textures but not to make car dirty. If it wasnt implemented in gta directly then it cannot be used. If it was introduced in silent patch then we could look at the changes and apply them to mta

TracerDS avatar Aug 08 '24 22:08 TracerDS

No. The only functions related to dirt level are constructors for dirt textures but not to make car dirty.

I see a code related to dirt level changes. Vehicles in mta have dirt textures, but dirt level doesn't update them. It looks like there is 8 textures, but gta stucks with only one of them

TheNormalnij avatar Aug 09 '24 15:08 TheNormalnij

I've talked about this with Silent a long time ago. I know that there is missing code in the CVehicleModelInfo::FindEditableMaterialListfunction (0x4C8490 some IDBs have it as ResetColors). This function is so short that it is inlined in CVehicleModelInfo::SetClump So Silent patch extends this function with the missing code (I don't know exactly what).

FileEX avatar Aug 09 '24 17:08 FileEX

Maybe we can reimplement it while consulting stuff with Silent (assuming he's still active)?

TracerDS avatar Aug 09 '24 17:08 TracerDS