News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Modify bombs?

Started by Jet3rd, February 20, 2018, 04:24:27 PM

Previous topic - Next topic

Jet3rd

Is there a way to make bombs have the damage of currently equipped beams.

Is there a way to make it so that if I use a bomb while highlighting missiles or super missiles it would have the damage of that ammo. Open the respective doors. and take away from the ammo of course.

And if this is possible. Can anyone create this for me?

mccad

Your best bet would be to hijack code from the vanilla bomb code into your own custom code in order to set the damage value. If you want to give it a try, you can find a great SM bank disassembly here. If you don't know ASM, I'm sure someone over at the metconst discord would be willing to help you out with that.

Jet3rd

I do not know asm and would appreciate if anyone offers to help. But I am gonna learn asm eventually.

So thanks for the info it helps. If anyone wants to go ahead and make this for me. I won't complain. But don't bother with it if it's tedious.

Dasfonia

I know nothing about actual assembly in SM.  But you'd need to make a pointer to the damage value of the beams and then point it to the bomb damage offset.  But that's just the idea of what you need to be doing.

PHOSPHOTiDYL

I can't help you with the second part, I've already failed.

First part is complicated. Planting a bomb is $90, bomb jump is $A0, projectiles are $93.
This can be done in $93. Check out that disassembly link posted, it's a large source of my powers.
You're not gonna magically get it the first time, but burn some code into you're head for the next time.
Just for a few hours, make some attempts, try to understand how things are working in the first $03C0 bytes.
Maybe look around for some disassembly on projectiles, learn how they're structured & where the damage values are.
If you don't know asm, you're gonna fail, but at least prove that you gave it a try, two hours experience is a lot more than zero.
Pretty much if you're serious about making a hack, I'll spend some time finding some stupid three byte hijack so bombs do beam damage.

Smiley

This was pretty easy so I whipped it up:
lorom

org $9380A6
  JSR NewDamage

org $93F620 ;Point this to free space in bank $93
NewDamage:
  LDA $0C19,x : AND #$000F                          ;Load projectile type
  CMP #$0005 : BEQ Bomb : CMP #$0085 : BEQ Bomb     ;Branch if bomb (0085 spread bomb, 0003 power bomb)
  RTS                                               ;Not a bomb, returns to vanilla code

Bomb:
  ASL A : TAY : LDA $83F1, y : STA $12                    ;Backup projectile
  LDA $09D2                                               ;\
  CMP #$0001 : BEQ HudDamage : CMP #$0002 : BEQ HudDamage ;/If missiles or supers are selected, use their damage
                                                          ;Else, use equipped beam damage

BeamDamage:
  LDA $09A6 : AND #$100F                                  ;Current beams
  BIT #$1000 : BEQ +                                      ;\If charge is equipped, use charged beam damage
  AND #$000F : ASL A : TAY : LDA $83D9,y : BRA SetDamage  ;/Remove these two lines to always use uncharged beam damage
+
  AND #$000F : ASL A : TAY
  LDA $83C1,y                                             ;Uncharged beam damage

SetDamage:
  TAY
  LDA $0000,y : STA $0C2C,x                        ;Set bomb damage
  PLA : PEA $80BD : LDY $12 : RTS                  ;Restore original projectile and return


HudDamage:
  ASL A : TAY
  LDA $83F1,y                                      ;Missile/Super Missile damage
  BRA SetDamage

This'll make bombs use whatever damage currently equipped beams deal, including Charge, but I left in a comment to remove that functionality if so desired. Also uses missile/super missile damage if either is selected.

Making bombs open doors requires editing the door PLMs. More specifically, the routines they use for hit detection. Hit detection for missile doors is at $84:BD50, for green doors at $84:BD88.

Jet3rd

Thank you. You guys gave me more help then I expected. I will mess around with stuff and try to figure out the rest myself and thanks for all the advice as well.