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

level: read animated textures in TRX #2400

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Jan 27, 2025

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change
  • I have added a readme entry about my new feature or OG bug fix, or it is a different change

Description

This gets TR2 using the same structured animated texture approach as TR1, and shifts reading the data to TRX. Each game still animates in its own output module because of slight differences there in tick handling.

This renames the animated texture struct and GBUF details and moves the
definition to TRX output.
This uses the same structured approach for animated textures as TR1.
@lahm86 lahm86 added Internal The invisible stuff TR2 TR1 labels Jan 27, 2025
@lahm86 lahm86 self-assigned this Jan 27, 2025
@lahm86 lahm86 requested review from a team as code owners January 27, 2025 18:27
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team January 27, 2025 18:27
Copy link

github-actions bot commented Jan 27, 2025

@lahm86 lahm86 force-pushed the common-anim-textures branch from 8bcf42c to 0abfec0 Compare January 27, 2025 18:33
size_t end_position = VFile_GetPos(file)
+ m_LevelInfo.anim_texture_range_count * sizeof(int16_t);
const int32_t data_size = VFile_ReadS32(file);
size_t end_position = VFile_GetPos(file) + data_size * sizeof(int16_t);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: const

sizeof(int16_t) * num_ranges, GBUF_ANIMATING_TEXTURE_RANGES);
VFile_Read(file, g_AnimTextureRanges, sizeof(int16_t) * num_ranges);
const int32_t data_size = VFile_ReadS32(file);
size_t end_position = VFile_GetPos(file) + data_size * sizeof(int16_t);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: const

Output_InitialiseAnimatedTextures(num_ranges);
Level_ReadAnimatedTextureRanges(num_ranges, file);

VFile_SetPos(file, end_position);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm isn't this function identical to TR1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is, we also have others more or less identical like objects and static meshes. But TR1 currently has the extra injection counts in some others; I'm hoping eventually we can get everything common shifted to the TRX reader. So with that difference, I was thinking it'd be cleaner for now to keep the similar base private functions in the two level modules and just move the common "intensive" reading out to TRX.
But equally, I'm happy to shift the identical ones over now if that's preferred overall.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No it's OK to keep them around, whichever is more comfortable for you 😌

@lahm86 lahm86 force-pushed the common-anim-textures branch from 0abfec0 to 0a3c9f5 Compare January 27, 2025 20:19
This shifts animated texture reading to TRX.
@lahm86 lahm86 force-pushed the common-anim-textures branch from 0a3c9f5 to b826c60 Compare January 27, 2025 20:25
@lahm86 lahm86 merged commit d15fb44 into LostArtefacts:develop Jan 27, 2025
8 checks passed
@lahm86 lahm86 deleted the common-anim-textures branch January 27, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal The invisible stuff TR1 TR2
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants