Radfordhound / HedgeLib

A C++ library and collection of tools that aims to make modding games in the Sonic the Hedgehog franchise easier.
MIT License
88 stars 24 forks source link

Resaving a terrain model containing sample chunk header doesn't keep its properties #74

Closed blueskythlikesclouds closed 3 years ago

blueskythlikesclouds commented 3 years ago

Original: image

Resaved: image

The code in question.

Is this intentional or a mistake? I'm making an issue since I'm not sure how I should be implementing it.

Radfordhound commented 3 years ago

Thanks for pointing this out! Yeah, this was a mistake on my part. It seems terrain models each have a single "root node", and sample chunk nodes can be utilized to apply SCA parameters to that node just like in skeletal models. I wasn't accounting for this in my code, so SCA parameters were skipped on read, thus causing them to be missing when resaving the file.

647a89c864401d78c7f8193a6d54a806fba3e280 should fix this. Please let me know if it doesn't!