Skip to content

feat: T5 and T6 destructible def dumper#886

Draft
uhhashe wants to merge 2 commits into
Laupetin:mainfrom
uhhashe:destructible-def-dumping
Draft

feat: T5 and T6 destructible def dumper#886
uhhashe wants to merge 2 commits into
Laupetin:mainfrom
uhhashe:destructible-def-dumping

Conversation

@uhhashe

@uhhashe uhhashe commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Adds dumping support to T5 and T6 for the DestructibleDef asset

@uhhashe
uhhashe marked this pull request as draft July 7, 2026 07:21
@uhhashe
uhhashe force-pushed the destructible-def-dumping branch from 0b40580 to 1242916 Compare July 7, 2026 07:26
@uhhashe
uhhashe marked this pull request as ready for review July 7, 2026 07:26
@Laupetin Laupetin added the enhancement New feature or request label Jul 7, 2026
if (context.m_gdt)
{
const auto infoString = CreateDestructiblePieceInfoString(piece, asset);
GdtEntry gdtEntry(asset.m_name + "::piece_" + std::to_string(i), GDF_FILENAME_DESTRUCTIBLE_PIECE);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I checked the official modtools and there were two destructible pieces in a gdt in total:
vehicle_american_jeep_base_piece and vehicle_american_jeep_piece (at least for supported games, BO3 has a bunch more).

But none were using a name with :: and i don't know how compatible that is exactly 😅

So i'd suggest to maybe

  • Use a name without special characters
  • Use the same name for the gdt entry and the file produces when it is raw

I'd suggest the following: {}_piece{:02}

Maybe add a new method in the DestructibleDefCommon for that creates a name for the destrucible piece and one that creates a filename so the filename method can just call the "name for destructible piece" method.

Also small nit: use std::format when possible 😛

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah the :: naming is just a guess from me, alot of this code is mostly from my Xbox 360 variant of the dumper I worked on last year, so some of it might be wrong like the fields and names, this is also why std::format isn't used.
I was gonna work on it some more but completely forgot about it until I got an email 😅


std::string GetFileNameForDestructiblePiece(const std::string& assetName, const int pieceIndex)
{
return std::format("destructiblepiece/{}_{}", assetName, pieceIndex);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

See previous comment about naming the destructible piece gdt entry

{"numPieces", offsetof(DestructibleDef, numPieces), CSPFT_INT },
{"pieces", offsetof(DestructibleDef, pieces), CSPFT_INT },
{"clientOnly", offsetof(DestructibleDef, clientOnly), CSPFT_INT },
};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm a bit confused on where these cspField_t definitions come from?
They are not from the game, the game does some weird weird stuff with 453 destructible def fields (instead of the 6 here) that overwrite parts of the destructiblepiece values.
Also 70 destructible piece fields (instead of the 55 here).

Don't understand me wrong, what the vanilla game does is absolutely horrible (adding 448 specific field types 🙃). I'm sure this could be solved better by creating a helper struct.
So i'd have nothing against solving this in a better way.
But as it is currently, this is omitting a lot of properties from the destructible def asset.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm sure I've seen these in the game, perhaps I'm remembering wrong. Well I'll get some time later and go back and change whats wrong

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah turns out I was wrong, I'm not sure what went wrong there

|----------------------|-----------------|-----------------|------------------------------------------------------------------------------|
| PhysPreset | ❌ | ❌ | |
| PhysConstraints | ❌ | ❌ | |
| DestructibleDef | ❌ | ❌ | |

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Any reason for omitting the T4 variant? Not that you have to do that here, just curious if there was a specific specialty on it that makes it different from the other two games. As you included T4 in the last PR for example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No reason, just never got around to working on the T4 one. This was worked on before I did any T4 work so that's kinda on me for not putting in the effort to also support T4 for this one

@uhhashe uhhashe closed this Jul 15, 2026
@uhhashe
uhhashe force-pushed the destructible-def-dumping branch from 1242916 to a87850d Compare July 15, 2026 07:12
@uhhashe uhhashe reopened this Jul 15, 2026
@uhhashe
uhhashe marked this pull request as draft July 15, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants