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

Make interval checks more readable by showing the real upper bond. #362

Closed
spixi opened this issue Jun 18, 2022 · 0 comments
Closed

Make interval checks more readable by showing the real upper bond. #362

spixi opened this issue Jun 18, 2022 · 0 comments

Comments

@spixi
Copy link

spixi commented Jun 18, 2022

In some cases the construct

cp LOWER_BOUND
jr c, .next
cp (UPPER_BOUND + 1)
jr nc, .next
ret z
.next
ld a, 1
and a
ret

is used to check if a value is in an interval. The Ghost battle check looks whether the current map is between POKEMON_TOWER_1F and POKEMON_TOWER_7F. MR_FUJIS_HOUSE is the next map after POKEMON_TOWER_7F, but it is a little confusing. To improve readability

cp MR_FUJIS_HOUSE

should say

cp (POKEMON_TOWER_7F + 1)

instead of

cp MR_FUJIS_HOUSE
@spixi spixi changed the title Make between comparsions more readable Make interval checks more readable by showing the real upper bond. Jun 18, 2022
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

1 participant