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

Serialize pixelmap/material/model/actor structs to file #80

Merged
merged 14 commits into from
Feb 6, 2022

Conversation

madebr
Copy link
Collaborator

@madebr madebr commented Feb 1, 2022

This pr add support for serializing pixelmaps, materials, models and actors:
the functions BrXXXSave and BrXXXSaveAll now have a (working) implementation.

To get there, this pr does:

  • implement all regsupt methods: it is now possible to enumerate/find/add/remove tables/maps/materials/models from the central registry
  • fix tests to handle with polluted brender state (=state where the register might not be empty)
  • fix the temporary folder/file logic in the tests to be more stable (=added tests)
  • Add a stub implementation for BrPixelmapDirectLock and BrPixelmapDirectUnlock.
  • Implement + test all vector functions, because I used some of these in the tests.
  • Add a BRENDER_FIX_BUGS cmake option to fix brender oversights. The tests will fail when not defining it.
  • Implement all brstddiag functions. The message passed toBrFailure will be printed to stdout.
  • Use BRender types in brstdfile.c
  • (Completely) implement v1dbfile + pmfile: serializing pixelmaps, materials, models and actors now work. I've added the chunk ids + stack ids to separate headers.
  • Fix test_loading_ConvertPixToStripMap on Linux. There was an issue with casings.
  • Fix the tests to work on Windows due to differences in endlines (\r\n vs \n).

Result of running github actions on my fork: https://github.com/madebr/dethrace/actions/runs/1778285699

br_file_struct br_face_F = { "br_face", BR_ASIZE(br_face_FM), br_face_FM, sizeof(br_face) };

br_file_struct_member br_old_face_1_FM[5] = {
{ DF_TYPE_BR_UINT_16, offsetof(br_face, vertices) + 0 * sizeof(br_uint_16), "vertices[0]", NULL },
Copy link
Owner

Choose a reason for hiding this comment

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

Can we not use the offsetof(br_face, vertices[1]) notation here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes we can. I will add a commit.

v1->v[0] = f1;
v1->v[1] = f2;
v1->v[2] = f3;
v1->v[0] = BR_SCALAR(f1);
Copy link
Owner

Choose a reason for hiding this comment

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

where does the wrapping to BR_SCALAR(f1) come from? Is it necessary? Are you interested in adding support for running brender in fixed mode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The wrapping comes from MATH/fixed.h.
It's not necessary, but I added it here to make it clear that a scalar is expected, not an explicit float/fixed.

I'm not that interested in getting fixed support working.
Getting dethrace working on current machines is a task big enough.

But I'd like to get our brender implementation sufficiently compatible with the brender used by carmageddon.
I would like to use our brender to link to the brender drivers and get good compatibility.

@dethrace-labs dethrace-labs merged commit 5260839 into dethrace-labs:master Feb 6, 2022
@madebr madebr deleted the deserializing branch February 6, 2022 10:43
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.

2 participants