Skip to content

Refactor random palettes and enemies#183

Merged
Miepee merged 3 commits intomainfrom
zm9-palettes-sprites
Sep 18, 2025
Merged

Refactor random palettes and enemies#183
Miepee merged 3 commits intomainfrom
zm9-palettes-sprites

Conversation

@biosp4rk
Copy link
Copy Markdown
Collaborator

@biosp4rk biosp4rk commented Sep 10, 2025

  • Added IntEnums for sprite IDs
  • Moved constants for palettes and enemies where appropriate
  • Added type alias for hue range

Some of the constants are dictionaries keyed by Game, we could also split them and put them in /mf and /zm

The interaction between the sprite ID IntEnums and normal ints is a bit awkward. I opted to convert the IDs to normal ints (see random_enemies.py line 11 as an example). There may be a cleaner way to do some of this, open to feedback

@biosp4rk
Copy link
Copy Markdown
Collaborator Author

Also I've been suffixing names with MF and ZM, might be more consistent/readable to use Mf and Zm

from mars_patcher.zm.constants.game_data import statues_cutscene_palette_addr
from mars_patcher.zm.constants.sprites import SpriteIdZM

HueRange: TypeAlias = tuple[int, int]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for the future, it may be better to make this a named tuple

Comment on lines +80 to +84
RINKA_MOTHER_BRAIN_C9 = 0xC9
RINKA_MOTHER_BRAIN_CA = 0xCA
RINKA_MOTHER_BRAIN_CB = 0xCB
RINKA_MOTHER_BRAIN_CC = 0xCC
RINKA_MOTHER_BRAIN_CD = 0xCD
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do these really not have better names apart from C9-CD?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not really, I think decomp names them 1 2 3 4 5

@Miepee Miepee merged commit 5aaf730 into main Sep 18, 2025
8 checks passed
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