alexbatalov / fallout2-re

Reverse engineered Fallout 2
Other
327 stars 34 forks source link

OBJECT_TYPE macro #99

Closed alexeevdv closed 2 years ago

alexbatalov commented 2 years ago

Thanks for you recent PRs. On this one. I really think OBJECT_TYPE name is too ambiguous. There is a mention ofproto_type in debug prints, implying there was a separate set of macros to obtain fields from fids and pids. Something like fidGetObjectType (as a rename for OBJECT_TYPE), fidGetFrmId, fidGetAnimation, fidGetWeaponAnimationCode will definitely bring more clarity to the codebase.

alexeevdv commented 2 years ago

OBJECT_TYPE macro is common for all kind if IDs. FID and PID share same "object type" marker. And SID has script type at the same position. We can make generic type extractor like GET_TYPE(id) or split them to FID_TYPE, PID_TYPE and SID_TYPE

alexbatalov commented 2 years ago

I would go with separate extractors. Even though object type is indeed stored in the upper byte on both fid and pid, they are representing entirely different things. FID_TYPE and PID_TYPE will make it obvious if you're dealing with fid or pid respectively, make things searchable, and eventually it will be easier to refactor for community edition if needed.