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

Fix turret anim frame calculation to match game #219

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

Starkku
Copy link
Contributor

@Starkku Starkku commented Feb 7, 2025

There is a discrepancy between the TurretAnim frame calculation between game (both TS and YR, I don't think this has been changed since TS since RA1 uses similar logic to calculate it) and the editor. This PR corrects that discrepancy by making it use same formula for frame calculation as game.

Game does the calculation by normalizing the direction to range 0-31 and using that as index to access a lookup table containing the frame indices (starting from 28, decrementing and wrapping around to 31 after 0). The implementation here does not use lookup table but should give same results regardless. The shadow frame selector is currently unused but I corrected it to use the new formula as well.

This issue is not particularly noticeable most of the time but the directional alpha images from #218 made it so as rotating a building with turret and a directional alpha image had the turret frames and alpha image frames out of sync.

@Rampastring Rampastring merged commit a3f570f into CnCNet:master Feb 7, 2025
1 check passed
@Starkku Starkku deleted the fix/turretanim-frame branch February 9, 2025 16:51
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