Altered health patch (Keen now flinches on hit)

Completed patches for Keen3.
Post Reply
User avatar
Flyingmouse
Posts: 104
Joined: Wed Aug 05, 2009 8:33 pm
Location: Procrastination

Altered health patch (Keen now flinches on hit)

Post by Flyingmouse »

I really like the health patch on Keenwiki, but simply getting Ankh time when hit got a little boring. This patch sets up a new Keen behavior (copies stun behavior, but non-animating and with different frames depending on direction) over the unused code at $7F03, then alters the original health code to use this new behavior when Keen is hit. By default the frames used are 28-29 (the two frames used in the stun behavior's animation), but this shouldn't cause any issues if changed. I'm not 100% sure this will work as given since this comes from a larger project and I may be missing patches, so if someone could give feedback I'd appreciate it.

Code: Select all

#Lives now act as health; Keen dies when hit with 1 health
#SIDE EFFECT: C-T-Space is disabled
#SIDE EFFECT: God Mode does not protect Keen from damage
#SIDE EFFECT: Getting a pogo kills Keen, last three patches allow Keen to pogo without the item
#Makes additional space (uses C-T-Space code by default, could be edited to free space if you move calls properly)
%patch $114E $EB $16  
#Pogo count triggers kill switch, used by hazard tiles
%patch $790C $81 $3E $9D1AW  $0001W  $0F $84 $06 $00 $E9 $954BW
#Main health code
%patch $0E64 $81 $3E $9946W  $0000W  $7F $28 $81 $3E $9D46W  $0001W  $7E $23    #Skips to points in code based on Ankh timer and lives
             $FF $0E $9D46W  $C7 $06 $9946W  $0100W  $C7 $44 $32 $7F03W  $8B    #Lose a life, Ankh timer set to 160 ($0100W), behavior set to 7F03
             $45 $20 $89 $44 $20 $8B $45 $22 $89 $44 $22 $C7 $44 $2A $0018W     #Flinch timer set to 24 ($0018W)
             $E9 $6ABDW  $E9 $6A82W                                             #End call for ankh time and 2+ lives, death call for 1 life
#Hazard tile gives pogo, triggering kill switch
%patch $7A32 $E8 $9465W 
%patch $0E9A $C7 $06  $9D1AW  $0001W  $E8 $6A66W  $C3
#Flinching behavior
%patch $7F03 $55 $8B $EC $83 $3E $6278W $00 $7C $08 $C7 $06 $38 $99 $001CW      #Checks direction, flinch left frame set to 28 ($001C)
             $EB $06 $C7 $06 $38 $99 $001DW  $A1 $993AW  $2B $06 $5D40W  $A3    #Flinch right frame set to 29 ($001D), time check
             $993AW  $83 $3E $993AW  $00 $7D $06 $C7 $06 $9942W  $6F07W  $83    #Time check, switch to 6F07 when timer hits 0
             $3E $9930W  $00 $7E $17 $B8 $FFFDW  $50 $E8 $E2E8W  $59 $83 $3E    #Check movement direction, alter l/r response
             $9930W  $00 $7D $06 $C7 $06 $9930W  $0000W  $EB $1C $83 $3E $9930W #Speed-related stuff (7F43-7F52)
                 $00 $7D $15 $B8 $0003W  $50 $E8 $E2CAW  $59 $83 $3E $9930W     #Speed-related stuff, alter l/r response
             $00 $7E $06 $C7 $06 $9930W  $0000W  $E8 $E345W  $E8 $E385W $E8     #Speed-related stuff, call gravity/tiles
             $EA90W  $5D $C3                                                    #Call movement (7F72-7F7A)

#Pogo count starts at 0 to avoid instant death
%patch $98F2 $0000W
#Keen doesn't need item to pogo
%patch $71BC $EB $05
%patch $744D $EB $0C
demarti
Posts: 1
Joined: Sat Feb 02, 2019 7:44 pm

Re: Altered health patch (Keen now flinches on hit)

Post by demarti »

Thanks!
Post Reply