Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,482,846
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-25-24 06:33 PM
Guest: Register | Login

0 users currently in ROM Hacking | 1 guest

Main - ROM Hacking - MM1 Weapon consumption New thread | New reply


Insectduel
Posted on 05-27-08 07:38 PM (rev. 3 of 05-27-08 07:56 PM) Link | Quote | ID: 84273


Hammer Brother
Level: 68

Posts: 67/1069
EXP: 2687613
Next: 41187

Since: 02-16-08
From: Insectduel's office

Last post: 1256 days
Last view: 1255 days
I've been fiddling around with the weapon energy in MM1. And I tested them too. Let's say my weapon consumption is 07 like the Cut weapon like I did with the Rock and Roll editor. I used the Cut weapon 4 times and all empty. But when I restore the weapon energy and use the weapon again that is LESS than 07, the weapon energy becomes negative.

And I found the code for it

MegamanWeaponConsumePower
$A8C0> A6 5F: LDX WeaponSelect

$A8C2> F6 9E: INC MetersFraction,X
$A8C4> B5 9E: LDA MetersFraction,X
$A8C6> DD D7A8: CMP WeaponPowerConsumptionDenominator-1,X [editing]
$A8C9> D0 0C: BNE +

$A8CB> A9 00: LDA #$00
$A8CD> 95 9E: STA MetersFraction,X
$A8CF> 38: SEC
$A8D0> B5 6A: LDA Meters,X
$A8D2> FD DEA8: SBC WeaponPowerConsumptionNominator-1,X [editing]
$A8D5> 95 6A: STA Meters,X
+
$A8D7> 60: RTS


I used different ASM routines but nothing stays equal. I need to know what correct ASM routine should have the consumption stays zero or unable to use the weapon less than 07. For some reason in MM1, most weapons do not use more than 02 uses. But in MM2, the leaf sheild or crash bomb has more uses than that.

NetSplit
Posted on 05-27-08 08:33 PM (rev. 2 of 05-27-08 09:36 PM) Link | Quote | ID: 84275


Level: 32

Posts: 77/178
EXP: 188021
Next: 18421

Since: 02-26-07

Last post: 2216 days
Last view: 2141 days
The code you're interested in is this:

MegamanWeaponFire
$A71E> A5 5F: LDA WeaponSelect
$A720> AA: TAX
$A721> 0A: ASL A
$A722> A8: TAY
$A723> F0 05: BEQ + ; P doesn't have a weapon meter
$A725> B5 6A: LDA Meters,X
$A727> D0 01: BNE + ; If there's still juice in that weapon
$A729> 60: RTS
+


Basically, you just need to be doing all the energy calculation stuff at $A725 rather than later on; the calculation code is currently run AFTER the weapon is already launched, I think. If using the weapon will give you a negative Meters,X value, then RTS. This will make it so that you can't use a weapon if the the current energy is less than the consumption.

Or, if you want a weapon with a consumption of, say, 3 to fire when you have 2 energy, then just zero the energy instead of letting it become negative. If this is how you'd prefer to do it, then all you need to do is this:

$A8D2> JSR Freespace

Freespace:
FD DE A8 SBC $A8DE,X
10 02 BPL $BF7D
A9 00 LDA #$00
60 RTS

Main - ROM Hacking - MM1 Weapon consumption New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.027 seconds. (341KB of memory used)
MySQL - queries: 37, rows: 58/59, time: 0.022 seconds.