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

Leaf shield checks for 3 ammo, regardless of actual consumption #166

Open
warmCabin opened this issue Mar 8, 2020 · 3 comments
Open

Leaf shield checks for 3 ammo, regardless of actual consumption #166

warmCabin opened this issue Mar 8, 2020 · 3 comments
Labels

Comments

@warmCabin
Copy link

Example seed: WCABIN (v0.5.0)

In this seed, Leaf Shield consumes 1 ammo, but it can't be used with 2 or less. This is a residual check from the vanilla game, where Leaf Shield takes 3 ammo.

@warmCabin
Copy link
Author

warmCabin commented Oct 3, 2020

Looks like this check is at 0F:DAF2, or $03DB02 in the ROM file.

>0F:DAF2:A5 9E     LDA $009E = #$0E
 0F:DAF4:E9 03     SBC #$03 ; Need to change this to whatever the actual consumption is
 0F:DAF6:90 10     BCC no_shield_for_you

Just need to add a patch to 0F:DAF5, or $03DB05 in the ROM file.

@duckfist
Copy link
Owner

I see, so there is another value containing the ammo cost that I missed, which is checked against to see if you run out of ammo. Is there a separate address for this for each weapon type? Is 0F:DAF5 only for Leaf Shield?

@duckfist duckfist added the bug label Oct 16, 2020
@warmCabin
Copy link
Author

Most weapons' energy usages evenly divides 28, with these exceptions:

  • Leaf Shield uses 3
  • Atomic Fire uses 6 and 10

In Rockman 2, it looks like the Atomic Fire check is done at 0F:DD7C:

 0F:DD7C:B9 41 DE  LDA $DE41,Y @ $DE42 = #$01
>0F:DD7F:C5 9C     CMP $009C = #$02

At 0F:D4E2, you can see the sequence 01, 06, 0A, which makes sense.

Some of the even divisors do check if you have enough ammo:

  • Crash Bomber checks if you have at least 4.

Others are prone to an underflow bug if you somehow have less than enough ammo:

  • Air Shooter
  • Item 1

The rest either tick down by 1 or are fractional, so this check is not applicable:

  • Bubble Lead
  • Quick Boomerang
  • Time Stopper
  • Metal Blade
  • Item 2
  • Item 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants