alloc8or / gta5-nativedb-data

A database of all GTAV script commands ("natives"). Strictly for educational purposes! https://alloc8or.re/gta5/nativedb/
184 stars 98 forks source link

Add better comments to attach natives and rename params to more accurate ones #239

Open kagikn opened 1 year ago

kagikn commented 1 year ago

This PR is mainly for camera attachment natives, but also includes changes for ATTACH_ENTITY_BONE_TO_ENTITY_BONE since it has a critical bug. Adds better comments so you can use camera attach natives without wild guessing. Also renames inaccurate params to more accurate ones as well.

Renames boneIndex param of ATTACH_CAM_TO_PED_BONE and HARD_ATTACH_CAM_TO_PED_BONE to boneId since it takes a bone tag value (not index of its skeleton) but typically named boneId in this DB.

Just in case you are wondering how "hard attachment" of camScriptedCamera works, you can search for "0F 84 89 00 00 00 F3 0F 10 83" for a related place in a camera update function (I think, at least camScriptedCamera has a pointer to this function in its vtable). The function considers the camera is hard attached to the entity that the cam is attached to when the 6th bit is set. You can find an address in all versions since b1180 where HARD_ATTACH_CAM_TO_PED_BONE is introduced.