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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kagikn
Copy link
Contributor

@kagikn kagikn commented Sep 4, 2023

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.

…ate ones

Add better comments so you can use camera attach natives without wild
guessing. Rename inaccurate params to more accurate ones as well.

ATTACH_ENTITY_BONE_TO_ENTITY_BONE has a critical issue, so I add a
warning note, as well as renaming 2 bools to descriptive params.
The docs of ATTACH_ENTITY_BONE_TO_ENTITY_BONE natives are incorrect in
the last 2 params in commands_entity.sch, so took more appropriate
param names from ATTACH_ENTITY_TO_ENTITY.
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

Successfully merging this pull request may close these issues.

1 participant