Gun Recoil Patch

Completed patches for Keen1.
Post Reply
lemm
Posts: 554
Joined: Sun Jul 05, 2009 12:32 pm

Gun Recoil Patch

Post by lemm »

Code: Select all

%ext ck1
%version 1.31


#Skip diagonal-key checking - make room
%patch $55EF $EB $4A          #jmp short 0x563B

#Jump to offset
%patch $3E52 $E9 $179CW	#jmp near 55F1

#Recoil Code
%patch $55F1 $56              #push si
%patch $55F2 $57              #push di
%patch $55F3 $BE $0030W       #mov si, RECOIL_RAMPDOWN (keen_pos_x)
%patch $55F6 $BF $0200W       #mov di, RECOIL (delta_x) #keen is moved RECOIL/100h pixels the frame after firing
%patch $55F9 $A1 $604CW       #mov ax, keen_facing (word_1909C)
%patch $55FC $3D $0000W       #cmp ax, word 0x0
%patch $55FF $7E $04          #jle short (+4)
%patch $5601 $F7 $DE          #neg si
%patch $5603 $F7 $DF          #neg di
%patch $5605 $89 $36 $8240W   #mov [keen_pos_x], si
%patch $5609 $89 $3E $823CW   #mov [delta_x], di
%patch $560D $5F              #pop di
%patch $560E $5E              #pop si
%patch $560F $83 $C4 $08      #add sp, byte 0x8 (patched over this instruction at $3E52)
%patch $5612 $E9 $E840W       #jmp near 3e55

#Wait time after shooting 
%patch $3E6A 1E		#sprite_sync value

Gives keen's gun recoil. If the rampdown is too long, keen will walk the opposite direction after he lowers the gun. Play with the wait time to correct this
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Less technical, more compact version, that works with all versions of CKPatch (Note, your initial patch needs a '$' before its final '1E' )

Code: Select all

%ext ck1
%version 1.31

#Give Keen's gun recoil:
%patch $55EF $EB $4A     #Make room
%patch $3E6A $1E         #Wait time after shot (Make larger for larger recoil)
%patch $3E52 $E9 $9C $17
%patch $55F1 $56 $57
             $BE $30 $00 #Recoil amount
             $BF $00 $02 
             $A1 $4C $60 $3D $00 $00 $7E $04 $F7 $DE $F7 $DF $89 $36
             $40 $82 $89 $3E $3C $82 $5F $5E $83 $C4 $08 $E9 $40 $E8

Very nice work!
Post Reply