Guest User

Untitled

a guest
Jun 26th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;     .           . · .
  2. ;       .       ·       ·       O
  3. ;         · . ·           · . ·
  4. ;
  5. ; Wavy-Ice hack for Metroid
  6. ; -------- ---- --- -------
  7. ;             by snarfblam
  8. ;             (at gmail.com)
  9. ;
  10. ; Allows combining of wave beam and ice beam.
  11. ; Also increases strength of ice, wavy-ice, and
  12. ; bombs.
  13. ;
  14. ; WARNING: THIS CODE IS NOT COMPATIBLE WITH
  15. ;          AND UNEXPANDED ROM!
  16. ; WARNING: THIS CODE IS NOT COMPATIBLE WITH
  17. ;          EDITROID 3.0. If you want to use
  18. ;          wavy-ice with a super-expanded
  19. ;          ROM, wait until Editroid 3.0 comes
  20. ;          out. I'll provide a compatible
  21. ;          wavy-ice hack.
  22. ;
  23. ; Things I Felt Like Saying
  24. ; ------ - ---- ---- ------
  25. ; - This code is designed to be assembled with
  26. ;   snarfblASM. If you want to use another assembler,
  27. ;   feel free to break the code up into several files,
  28. ;   assemble them separately, and insert them
  29. ;   individually.
  30. ; - This code is designed to work with an expanded
  31. ;   metroid ROM. If you want to use it with an un-
  32. ;   expanded ROM you need to:
  33. ;     - Move the NEW code to a different location where
  34. ;       there is free memory
  35. ;     - Change all .PATCH directives to use bank 07
  36. ;       instead of 0F.
  37.  
  38.  
  39. ;===========================================
  40. ; Allow weapon combining
  41. ; ----- ------ ---------
  42. ; NOPs out the code that removes one beam
  43. ; when the play aquires another.
  44. ;===========================================
  45. .PATCH 0F:DBD2
  46.  
  47.        NOP ; LDA $6878
  48.        NOP
  49.        NOP
  50.  
  51.        NOP ; AND #$3F
  52.        NOP
  53.  
  54.        NOP ; STA $6878
  55.        NOP
  56.        NOP
  57.  
  58.  
  59.  
  60. ;===========================================
  61. ; New Behavior
  62. ; --- --------
  63. ; Calls the appropriate routine to update
  64. ; beam projectiles.
  65. ;===========================================
  66.  
  67. ; Hijack
  68. ; ------
  69. .PATCH 0F:D5C5
  70.        JMP $C6B9
  71.  
  72.  
  73. ; New code
  74. ; --- ----
  75. ; Updates ice with wave behavior if the player has ice+wave, otherwise
  76. ; updates with normal ice behavior
  77.  
  78. .PATCH 0F:C6B9
  79.        LDA $6878    ; Check equipment
  80.        AND #$40     ; Has wave?
  81.        BEQ NoWave
  82.        JMP $D52C    ; Yes: UpdateWaveBullet
  83.        ;(normally UpdateWaveBullet isn't called when you have ice, even if you do have wave)
  84.  
  85.     NoWave:
  86.         JMP $D4EB    ; No: UpdateBullet
  87.  
  88.  
  89.  
  90. ;===========================================
  91. ; New Damage
  92. ; --- ------
  93. ; Specifies damage amount for wave+ice. Also
  94. ; increases damage dealt by bombs and
  95. ; vanilla ice. Heh.
  96. ;===========================================
  97.  
  98. ; Hijack
  99. ; ------
  100. .PATCH 0F:F5EE
  101.         JMP $C6C6
  102.  
  103.  
  104. ; New Code
  105. ; --- ----
  106.  
  107. .PATCH 0F:C6C6
  108.         ; Y: Weapon type
  109.         ;   1 = Normal
  110.         ;   2 = Wave
  111.         ;   3 = Ice or Wavy-ice
  112.         ;   A = Bomb
  113.         ;   B = Missile (I think)
  114.         ; X: Enemy index
  115.         ; 40B,X: enemy health
  116.  
  117.         LDY $040E,X        ; Get projectile that hit enemy
  118.         LDA $6878          ; Get current equipment
  119.  
  120.         CPY #$03           ; If Ice...
  121.         BNE NotIce
  122.  
  123.     Ice:
  124.         AND #$C0           ;     Does the player have wave and ice beams?
  125.         BNE Damage4        ;     If so, 4 damage
  126.         BEQ Damage2        ;     Else, 2 damage
  127.  
  128.     NotIce:
  129.     ; Includes vanilla-beam, bomb, wave, and missile
  130.         CPY #$0A           ; Bomb = 4 Damage
  131.         BEQ Damage4
  132.         CPY #$02           ; Wave = 2 Damage
  133.         BEQ Damage2
  134.  
  135.         BIT $0A            ; Not-a-boss = 1 Damage
  136.         BVC Damage1
  137.  
  138.     IsABoss:
  139.         CPY #$0B           ; Vanilla-beam = 1 damage
  140.         BNE Damage1        ; (missile will fall thru and do 4 damage)
  141.  
  142.     Damage4:
  143.         DEC $040B,X
  144.         BEQ exitRoutine
  145.     Damage3:
  146.         DEC $040B,X
  147.         BEQ exitRoutine
  148.     Damage2:
  149.         DEC $040B,X
  150.         BEQ exitRoutine
  151.     Damage1:
  152.         DEC $040B,X
  153.    
  154.     exitRoutine:
  155.         ; Return to F60F (this is the code that checks if enemies has
  156.         ; 0 HP and if so, kills him)
  157.         JMP $F60F
  158.  
  159.  
  160. ; Original code
  161. ; -------- ----
  162. ; Included for comparison
  163. ;   cpy #$02                ; Was enemy hit by wave?
  164. ;   beq +
  165. ;   bit $0A                 ; ?? (Might be a check for boss)
  166. ;   bvc ++                  ; If not, do 1 damage
  167. ;   ldy $040E,x
  168.  
  169. ;   cpy #$0B                ; Was enemy hit by missile?
  170. ;   bne ++                  ; If not, do 1 damage
  171.  
  172. ;   dec EnHitPoints,x       ; Do 4 damage
  173. ;   beq +++
  174. ;   dec EnHitPoints,x
  175. ;   beq +++
  176. ;*      dec EnHitPoints,x       ; Do 2 damage
  177. ;   beq ++
  178. ;*  dec EnHitPoints,x       ; Do 1 damage
Add Comment
Please, Sign In to add comment