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

Original code bug object animation hash #127

Open
Pyrdacor opened this issue Jan 6, 2025 · 4 comments
Open

Original code bug object animation hash #127

Pyrdacor opened this issue Jan 6, 2025 · 4 comments

Comments

@Pyrdacor
Copy link
Owner

Pyrdacor commented Jan 6, 2025

There is a bug in original code where the hash for random object animations is precalculated. Instead of reading the map width with Map_width(a0), it just directly uses Map_width as a value which is an offset and has value 4. See:

https://github.com/jhorneman/ambermoon/blob/52e36804e1f211330d884a79ecc5559138c4974d/src/MAP/3D_MAP.S#L2500

@Pyrdacor
Copy link
Owner Author

Pyrdacor commented Jan 6, 2025

Not sure if this matters or what influence this actually has. Just found it while investigated stuff for AA.

@Pyrdacor
Copy link
Owner Author

Pyrdacor commented Jan 6, 2025

Some background. For normal 3D objects (non-NPCs) there is some hash value which is used for random animations (if the flag bit is set). The hash is first calculated as tileX + tileY * mapWidth (at least after the fix). This is done per tile to have some base value.

Then for each object, to this base value the relative object X, Y and Z values are added.

Based on animation type (wave or circle) there are some lists of words. The first word is added to the total hash value and then ANDed with $f. This is then used as a bit index to check if the bit is set in the second word. And if so, the frame is changed.

Hard to determine the effects.

@a1exh
Copy link

a1exh commented Jan 6, 2025

Do you think it might correspond to any of the previously reported graphical bugs in the Amiga version of Ambermoon?

@Pyrdacor
Copy link
Owner Author

Pyrdacor commented Jan 6, 2025

I don't think so. This just is a hash used to decide if the frame is increased or not. The frames themselves are intact. It just influences how fast or often animations happen.

I am not sure if this is notable at all. Most likely not.

It was just a lucky catch.

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

No branches or pull requests

2 participants