Metroid: Wavy-Ice

Wavy-Ice screenshot

Shootin' through stuff. Freezing stuff. Wavy-Ice can do it all!

I’ve decided to share my simple Wavy-Ice hack. It allows the player to combine the wave beam and ice beam in Metroid. Note that this only works on a ROM expanded by Editroid 2.1. It will not work on an unexpanded ROM or an Editroid 3.0 ROM (I’ll release an updated patch for Editroid 3.0).

I’ve put together a zip containing the code, an assembler, and a ready-to-go IPS patch. The code should be assembled with snarfblASM to produce an IPS file:

>snarfblasm wavyice.asm wavyice.ips -IPS:ON

For your viewing pleasure:

;     .           . · .
;       .       ·       ·       O
;         · . ·           · . ·
;
; Wavy-Ice hack for Metroid
; -------- ---- --- -------
;             by snarfblam
;             (at gmail.com)
;
; Allows combining of wave beam and ice beam.
; Also increases strength of ice, wavy-ice, and
; bombs.
;
; WARNING: THIS CODE IS NOT COMPATIBLE WITH
;          AND UNEXPANDED ROM!
; WARNING: THIS CODE IS NOT COMPATIBLE WITH
;          EDITROID 3.0. If you want to use
;          wavy-ice with a super-expanded
;          ROM, wait until Editroid 3.0 comes
;          out. I'll provide a compatible
;          wavy-ice hack.
;
; Things I Felt Like Saying
; ------ - ---- ---- ------
; - This code is designed to be assembled with
;   snarfblASM. If you want to use another assembler,
;   feel free to break the code up into several files,
;   assemble them separately, and insert them
;   individually.
; - This code is designed to work with an expanded
;   metroid ROM. If you want to use it with an un-
;   expanded ROM you need to:
;     - Move the NEW code to a different location where
;       there is free memory
;     - Change all .PATCH directives to use bank 07
;       instead of 0F.

;===========================================
; Allow weapon combining
; ----- ------ ---------
; NOPs out the code that removes one beam
; when the play aquires another.
;===========================================
.PATCH 0F:DBD2

        NOP ; LDA $6878
        NOP
        NOP

        NOP ; AND #$3F
        NOP

        NOP ; STA $6878
        NOP
        NOP

;===========================================
; New Behavior
; --- --------
; Calls the appropriate routine to update
; beam projectiles.
;===========================================

; Hijack
; ------
.PATCH 0F:D5C5
        JMP $C6B9

; New code
; --- ----
; Updates ice with wave behavior if the player has ice+wave, otherwise
; updates with normal ice behavior

.PATCH 0F:C6B9
        LDA $6878    ; Check equipment
        AND #$40     ; Has wave?
        BEQ NoWave
        JMP $D52C    ; Yes: UpdateWaveBullet
        ;(normally UpdateWaveBullet isn't called when you have ice, even if you do have wave)

    NoWave:
        JMP $D4EB    ; No: UpdateBullet

;===========================================
; New Damage
; --- ------
; Specifies damage amount for wave+ice. Also
; increases damage dealt by bombs and
; vanilla ice. Heh.
;===========================================

; Hijack
; ------
.PATCH 0F:F5EE
        JMP $C6C6

; New Code
; --- ----

.PATCH 0F:C6C6
        ; Y: Weapon type
        ;   1 = Normal
        ;   2 = Wave
        ;   3 = Ice or Wavy-ice
        ;   A = Bomb
        ;   B = Missile (I think)
        ; X: Enemy index
        ; 40B,X: enemy health

        LDY $040E,X        ; Get projectile that hit enemy
        LDA $6878          ; Get current equipment

        CPY #$03           ; If Ice...
        BNE NotIce

    Ice:
        AND #$C0           ;     Does the player have wave and ice beams?
        BNE Damage4        ;     If so, 4 damage
        BEQ Damage2        ;     Else, 2 damage

    NotIce:
    ; Includes vanilla-beam, bomb, wave, and missile
        CPY #$0A           ; Bomb = 4 Damage
        BEQ Damage4
        CPY #$02           ; Wave = 2 Damage
        BEQ Damage2

        BIT $0A            ; Not-a-boss = 1 Damage
        BVC Damage1

    IsABoss:
        CPY #$0B           ; Vanilla-beam = 1 damage
        BNE Damage1        ; (missile will fall thru and do 4 damage)

    Damage4:
        DEC $040B,X
        BEQ exitRoutine
    Damage3:
        DEC $040B,X
        BEQ exitRoutine
    Damage2:
        DEC $040B,X
        BEQ exitRoutine
    Damage1:
        DEC $040B,X

    exitRoutine:
        ; Return to F60F (this is the code that checks if enemies has
        ; 0 HP and if so, kills him)
        JMP $F60F

; Original code
; -------- ----
; Included for comparison
;    cpy #$02                ; Was enemy hit by wave?
;    beq +
;    bit $0A                 ; ?? (Might be a check for boss)
;    bvc ++                  ; If not, do 1 damage
;    ldy $040E,x

;    cpy #$0B                ; Was enemy hit by missile?
;    bne ++                  ; If not, do 1 damage

;    dec EnHitPoints,x       ; Do 4 damage
;    beq +++
;    dec EnHitPoints,x
;    beq +++
;*      dec EnHitPoints,x       ; Do 2 damage
;    beq ++
;*    dec EnHitPoints,x       ; Do 1 damage

Leave a Reply

Your email address will not be published.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">