Skip to content

Conversation

@Muhlex
Copy link

@Muhlex Muhlex commented Oct 18, 2021

Credit to @K0bin, who helped me scriptkiddie my way through C++.

This might suck but what it does is modify xmodels that when they are built into a fastfile for IW4, bones are mapped to the correct hit locations for riot shield hits.

Thanks to @Laupetin!

Discord Log


if (data->partClassification)
{
char *shieldAdjustedPartClassification = new char[data->numBones];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to point out that ZoneMemory class utilitiy is provided inside src\ZoneUtils\Zone.

You could:
auto shieldAdjustedPartClassification = this->ManualAlloc<char>(data->numBones);

This has the advantage that the buffer is set to 0 using memset, then it will be automatically disposed of without you explicitly using the delete operator when the ZoneMemory object is deleted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I'd like to fix this at some point, but don't have the time to get into C++ as a language enough even. Especially as I'm not even sure if this should be part of zonetool in the place where it is. Might make this a bit nicer at some point, but can't right now.

Feel free to edit any of it if you are interested.


for (int i = 0; i < data->numBones; i++)
{
uint16_t boneNameIndex = data->boneNames[i];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use std::uint16_t like it's done throughout the repo or auto I guess

@RektInator
Copy link
Member

You put the code in the write code. I don't think this would be the correct place to apply this logic in. write stage is purely meant for writing data to the fastfile.

@Muhlex
Copy link
Author

Muhlex commented Oct 25, 2021

You put the code in the write code. I don't think this would be the correct place to apply this logic in. write stage is purely meant for writing data to the fastfile.

I see what you mean, and just simply doing this there without telling the user is a shady side-effect imo. But I'm not sure where else to do it. Were I to do it on the export from a IW3 zone, that would mean the model might break when recompiled to IW3 I guess? Because only IW4 (probably IW5 uses the same bones but I don't know about that) needs this fix for models exported via CoD4 asset manager.

Or are you simply talking about where I put it in the code, and not in which stage it happens logically? In that case, I can check the repo in more detail if I ever have the time/skills to actually contribute.

Loyalists added a commit to Loyalists/zonetool that referenced this pull request Oct 10, 2022
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.

4 participants