Bounders act like a Toad

Request patches for Keens 4-6.
Post Reply
User avatar
Alopex
Posts: 34
Joined: Thu Jun 15, 2017 7:27 pm
Location: Bloogfoods, Inc.

Bounders act like a Toad

Post by Alopex »

Hello everyone,

I'd like to submit the following patch request for the Bounders: I want them to behave like toads/frogs. Specifically:
  • They should only bounce left and right, not vertically;
  • When they bounce, they should jump like frogs (similar to the Dartfrogs in Atroxian Realm). They should have two sprites for each bouncing direction: one for the idle position and one for the jumping animation.
If possible (though not strictly necessary but desiderable), I'd also like the Bounders to only kill Keen when they're bouncing, as if they're "smashing" him on the ground.

Thanks in advance!

Regards,

-- Alopex
User avatar
Quillax
Posts: 28
Joined: Sun Mar 27, 2016 5:48 pm
Contact:

Re: Bounders act like a Toad

Post by Quillax »

If you just want to make Bounders act like the Dartfrogs from Atroxian Realm, you could just reuse the relevant patches from the demo (back when it was a Keen 4 mod):

Code: Select all

###
#Bounders
###


# Keen Collision Function
# Bounders are now toxic frog guys, so keen can't stand on them now

%patch $CCD2 $90 $90 $90 #nop slide over jump to call to keen-stand-on-bounder-funnctio

%patch $CDC9 $EB #and he can't stand on a stunned bounder ,either


# Actions
%patch $31D82
0x1EFW 0x1EFW 3W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F30W  # sitting frame 1
0x1F0W 0x1F0W 3W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F12W	# sitting frame 2
0x1ECW 0x1EEW 2W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F4EW	# up frame
0x1EBW 0x1EDW 2W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F6CW  # down frame
0x1EFW 0x1EFW 2W 0W 0W 0W 0W 0W 	$09DC16C9RL $0L			$09DC1913RL $2FA8W
0x1F1W 0x1F1W 2W 0W 0W 0W 0W 0W		$09DC16C9RL $0L			$09DC1913RL $0W


# NEW Bounder Draw Function
#1080097E
%patch $1117E
$55                  #push    bp                      
$8B $EC              #mov     bp, sp                  
$83 $EC $02          #sub     sp, 2                   
$56                  #push    si                      
$57                  #push    di                      
$8B $7E $06          #mov     di, [bp+arg_0]          

#botflags:
$83 $7D $3A $00      #cmp     [di+OBJECT.botflags], 0 
$74 $05              #jz      topflags
$C7 $45 $18 0W		 #mov     [di+OBJECT.ymove], 0    

					 #topflags:
					 #;increase int34 until threshold, then jump
$83 $7D $36 $00      #cmp     [di+OBJECT.topflags], 0 
$75 28		         #jnz      #onground
$81 $7D $1C $2F4EW   #cmp     [di+OBJECT.action], bounder_air
$74 18		         #jz      #sideflags

$B8 $2F4EW			 # mov ax, offset bounder_air
$50				     #push ax
$57					 #push di
$9A $09DC120ARL		 #call CheckGround2
$83 $C4 $04			 #add sp, 4
$C7 $45 $44 $0W		 #mov [di+objtype.int34], 0
$E9 99W		         #jmp sideflags

					 # onground:
$C7 $45 $16 $0000W   #mov [di+object.xmotion], 0000W
$81 $7D $1C $2F6CW   #cmp     [di+OBJECT.action], bounder_air
$74 13		         #jz      checkbouncetime
$B8 $2F6CW			 # mov ax, offset bounder_ground
$50				     # push ax
$57					 # push di
$9A $09DC120ARL		 # call CheckGround2
$83 $C4 $04			 # add sp, 4

					 # checkbouncetime:
$8B $45 $44			 #mov	ax, [di+objtype.int34]
$40					 #inc	ax
$89 $45 $44			 #mov	[di+objtype.int34], ax
$3D $0020W			 #cmp	ax, BOUNDERJUMPTIME
$7C 57				 #jl		sideflags

$C7 $45 $44 $0W		 #mov	word ptr [di+objtype.int34], 0
$8B $1E $A7D6W		 #mov bx, player
$8B $45 $0A			 #mov ax, [di+object.posx]
$39 $47 $0A			 #cmp [bx+object.posx], ax
$73 $07				 #jnb BounceRight
#BounceLeft:
$C7 $45 $0E $FFFFW   #mov [di+object.xmotion], FFFFW
$EB $05				 #jmp short dobounce
#BounceRight:
$C7 $45 $0E $0001W	 #mov [di+object.xmotion, 1W
#dobounce:
$8B $45 $0E			 # mov     ax, [di+OBJECT.xmotion]
$BA $10 $00 		 # mov     dx, 10h
$F7 $EA     		 # imul    dx
$89 $45 $16 		 # mov     [di+OBJECT.xmove], ax
$C7 $45 $18 $FFD0W	 #mov [di+OBJECT.ymove], FFD0

$B8 $0010W  $50 $9A $187409F1RL $83 $C4 $02 #Play sound

#11208
$83 $7D $38 $00     #sideflags:      cmp     [di+OBJECT.rightflags], 0
$75 $06             #                jnz     short reverseX
$83 $7D $3C $00     #                cmp     [di+OBJECT.leftflags], 0
$74 $10             #                jz      short draw
$8B $45 $0E         #reverseX:       mov     ax, [di+OBJECT.xmotion]
$F7 $D8             #                neg     ax
$89 $45 $0E         #                mov     [di+OBJECT.xmotion], ax
$8B $45 $16         #                mov     ax, [di+OBJECT.xmove]
$F7 $D8             #                neg     ax
$89 $45 $16         #                mov     [di+OBJECT.xmove], ax
$FF $75 $20         #draw:           push    [di+OBJECT.zplane] ; int
$33 $C0             #                xor     ax, ax
$50                 #                push    ax              ; int
$FF $75 $1E         #                push    [di+OBJECT.chunk] ; value
$FF $75 $0C         #                push    [di+OBJECT.ypos] ; int
$FF $75 $0A         #                push    [di+OBJECT.xpos] ; int
$8B $C7 $05			#                mov     ax, di
$46 $00             #                add     ax, 46h
$50                 #                push    ax              ; int
$9A $16541641RL	    #                call    RF_PlaceSprite                     
$83 $C4 $0C         #                add     sp, 0Ch                            
$5F                 #                pop     di                                 
$5E                 #                pop     si                                 
$8B $E5             #                mov     sp, bp                             
$5D                 #                pop     bp                                 
$CB                 #                retf                                       

#Collision
#Bounder kills Keen, can be shot: 
%patch $11138 
$55 
$8B $EC 
$56 $57 
$8B $76 $06 						# mov	si, [bp+6]
$8B $7E $08							# mov	di, [bp+8] 
$83 $3D $02							# cmp	[di], 2 ; stunner
$75 $09 
$9A $0B8013E9RL $5F $5E $5D $CB		# call killkeen and return 
$83 $3D $03							# cmp [di], 3  ; stunner
$75 $1D 
$C7 $44 $16 $00 $00 
$C7 $44 $06 $01 $00 
$B8 $A8 $2F 
$50 
$57 
$56 
$9A $09DC1695RL 
$83 $C4 $06 
#$C7 $44 $00 $00 $01	# type = 01,  (obj_friendly)
$90 $90 $90 $90 $90
$5F $5E $5D $CB






#3 frame loop
%patch $32700
$1B8W $1B8W $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $38AEW 
$1B9W $1B9W $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $38CCW 
$1BAW $1BAW $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $3890W 

#Collision Function
#altered so that mine does not blow up and does not make sound when contact keen

%patch $127B9 $90 $90 $90 $90 $90 #don't change action to explosion
%patch $127C5 $90 $90 $90 $90 $90 #don't play a sound





#actions
#2 movement actions (smooth movement always thinking)
%patch $3154E
$1C9W $1C9W $1W $1W $1W $4W $11W $0W $10800071RL $108000B0RL $10800100RL $26FCW 
$1C9W $1C9W $1W $1W $1W $4W $11W $0W $10800071RL $108000B0RL $10800100RL $26DEW 
$1C9W $1C9W $1W $1W $1W $4W $18W $0W $0L         $108000B0RL $10800100RL $2738W 
$1C9W $1C9W $1W $1W $1W $4W $18W $0W $0L         $108000B0RL $10800100RL $26DEW 

#attacking actions
#stunned action

#default movement think
#if player is close enough, go to attacking action.

#spawn -- set health
%patch $1081C
$C7 $47 $3E 02W			#mov [si+objtype.int31], 2

%patch $10836
$40W				# map units to move sprite down on spawn

%patch $10871 
#$10800071RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si
$8B $76 $06 			#mov si, [bp+6]


						#checky;
$8B $1E $A7D6W			# mov bx, [player]
$8B $47 $32				#mov ax, [bx+boxT.lr.y]
$2B $44 $32				#sub ax, [si+boxT.lr.y]
$3D $2W					#cmp ax, 2
$7F  34					#jg return
$3D $FFFEW	  			#cmp ax, -2
$7C  29					#jl return
						
						#checkx:
$8B $47 $2A				# mov ax, [bx+object.boxXmid]
$2B $44	$2A				# sub ax, [si+object.boxXmid]
$3D $200W 				#cmp ax, 0x200
$7F  18					#jg return
$3D $FE00W				#cmp ax, 0xFE00
$7C  13	  				#jl return
						
						#doattack:
$B8 $271AW				#mov ax, a_wormmouthattack1
$50						#push ax
$56						#push si
$9A $09DC120ARL			#call CheckGround2
$83 $C4 $04				#add sp, 4

						#return:
$5E	
$8B $E5 
$5D			#pop si; mov sp, bp; pop bp
$CB						#retf
						


#collision
#check for shots, decrease health, set whiteflash, die if health <0
%patch $108B0
#$108000B0RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si
$57						#push di
$8B $76 $06 			#mov si, [bp+6]
$8B $7E $08 			#mov di, [bp+8]

						#kill keen
$83 $3D $02				#cmp word ptr [di], 2
$75  07					#jnz checkstunner
$9A $0B8013E9RL			#call KeenDie
$EB  44					#jmp return

						#checkstunner:
$83 $3D $03				#cmp word ptr [di], 3
$75	 39					#jnz return
$57						#push di
$9A $0D8F0D43RL			#call StunnerZaps
$83 $C4 $02				#add sp, 2
$FF $4C $3E				#dec [si+obtype.int31]
$75  20					#jnz notdead

						#dead:
$C7 $44 $40 0W			#mov [si+int32], 0
$B8 $2882W				#mov ax, a_wormmouthstunned
$50						#push ax
$56						#push si
$9A $09DC120ARL			#call CheckGround2
$83 $C4 $04				#add sp, 4
$EB  05					#jmp return

#notdead:
$C7 $44 $40 5W			#mov [si+int32], WHITEFLASH

#return:
$5F $5E $8B $E5 $5D $CB	#pop di;pop si; mov sp, bp; pop bp; retf



#drawfunc (decrease whiteflash, draw white if != 0) 
%patch $10900
#$10800100RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si      
$8B $76 $06 			#mov si, [bp+6]

#Portion of DrawFunc2 that turns actor around at walls and edges
$83 $7C $0E $01
$75 $2B 
$83 $7C $3C $00 
$74 $25  
$8B $44 $12 
$29 $44 $0A 
$C7 $44 $0E $FF $FF 
$9A $1D02002ARL      
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C 
$56 
$9A $09DC120ARL		 
$83 $C4 $04 
$EB $5D 
$83 $7C $0E 
$FF $75 $2B 
$83 $7C $38 $00 
$74 $25 
$8B $44 $12 
$29 $44 $0A 
$C7 $44 $0E $01 $00 
$9A $1D02002ARL      
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C $56 
$9A $09DC120ARL 
$83 $C4 $04 
$EB $2C 
$83 $7C $36 $00 
$75 $26 
$8B $44 $12 
$29 $44 $0A  
$8B $44 $0E 
$F7 $D8 
$89 $44 $0E 
$9A $1D02002ARL     
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C 
$56 
$9A $09DC120ARL 
$83 $C4 $04

# Start Drawing
$FF $74 $20				#push [si+objtype.zplane]
$33 $C0					#xor ax, ax
$83 $7C $40 $00				#cmp [si+objtype.int32], 0
$74 $04					#jz draw
$FF $4C $40				#dec [si+obtype.int32]
$40						#inc ax ; push 1


#draw:
$50						#push ax
$FF $74 $1E
$FF $74 $0C 
$FF $74 $0A 
$8B $C6 
$05 $46 $00 
$50 
$9A $16541641RL 
$83 $C4 $0C 

$5E	$8B $E5 $5D			#pop si; mov sp, bp; pop bp
$CB						#retf
I set up a test copy of The Sunnylands (Keen 4 levelpack where most patches are just for text), put the above patches into the patch file, and it works just fine!

As for making the Bounder only harmful when bouncing, I'm not really a patching expert, but I imagine it would be tricky to perform, even for talented patch-makers. I could be wrong, though.
User avatar
Alopex
Posts: 34
Joined: Thu Jun 15, 2017 7:27 pm
Location: Bloogfoods, Inc.

Re: Bounders act like a Toad

Post by Alopex »

Quillax wrote: Sat Oct 26, 2024 8:50 am If you just want to make Bounders act like the Dartfrogs from Atroxian Realm, you could just reuse the relevant patches from the demo (back when it was a Keen 4 mod):

Code: Select all

###
#Bounders
###


# Keen Collision Function
# Bounders are now toxic frog guys, so keen can't stand on them now

%patch $CCD2 $90 $90 $90 #nop slide over jump to call to keen-stand-on-bounder-funnctio

%patch $CDC9 $EB #and he can't stand on a stunned bounder ,either


# Actions
%patch $31D82
0x1EFW 0x1EFW 3W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F30W  # sitting frame 1
0x1F0W 0x1F0W 3W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F12W	# sitting frame 2
0x1ECW 0x1EEW 2W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F4EW	# up frame
0x1EBW 0x1EDW 2W 0W 0W 20W 0W 0W	$09DC16C9RL $10800938RL $1080097ERL $2F6CW  # down frame
0x1EFW 0x1EFW 2W 0W 0W 0W 0W 0W 	$09DC16C9RL $0L			$09DC1913RL $2FA8W
0x1F1W 0x1F1W 2W 0W 0W 0W 0W 0W		$09DC16C9RL $0L			$09DC1913RL $0W


# NEW Bounder Draw Function
#1080097E
%patch $1117E
$55                  #push    bp                      
$8B $EC              #mov     bp, sp                  
$83 $EC $02          #sub     sp, 2                   
$56                  #push    si                      
$57                  #push    di                      
$8B $7E $06          #mov     di, [bp+arg_0]          

#botflags:
$83 $7D $3A $00      #cmp     [di+OBJECT.botflags], 0 
$74 $05              #jz      topflags
$C7 $45 $18 0W		 #mov     [di+OBJECT.ymove], 0    

					 #topflags:
					 #;increase int34 until threshold, then jump
$83 $7D $36 $00      #cmp     [di+OBJECT.topflags], 0 
$75 28		         #jnz      #onground
$81 $7D $1C $2F4EW   #cmp     [di+OBJECT.action], bounder_air
$74 18		         #jz      #sideflags

$B8 $2F4EW			 # mov ax, offset bounder_air
$50				     #push ax
$57					 #push di
$9A $09DC120ARL		 #call CheckGround2
$83 $C4 $04			 #add sp, 4
$C7 $45 $44 $0W		 #mov [di+objtype.int34], 0
$E9 99W		         #jmp sideflags

					 # onground:
$C7 $45 $16 $0000W   #mov [di+object.xmotion], 0000W
$81 $7D $1C $2F6CW   #cmp     [di+OBJECT.action], bounder_air
$74 13		         #jz      checkbouncetime
$B8 $2F6CW			 # mov ax, offset bounder_ground
$50				     # push ax
$57					 # push di
$9A $09DC120ARL		 # call CheckGround2
$83 $C4 $04			 # add sp, 4

					 # checkbouncetime:
$8B $45 $44			 #mov	ax, [di+objtype.int34]
$40					 #inc	ax
$89 $45 $44			 #mov	[di+objtype.int34], ax
$3D $0020W			 #cmp	ax, BOUNDERJUMPTIME
$7C 57				 #jl		sideflags

$C7 $45 $44 $0W		 #mov	word ptr [di+objtype.int34], 0
$8B $1E $A7D6W		 #mov bx, player
$8B $45 $0A			 #mov ax, [di+object.posx]
$39 $47 $0A			 #cmp [bx+object.posx], ax
$73 $07				 #jnb BounceRight
#BounceLeft:
$C7 $45 $0E $FFFFW   #mov [di+object.xmotion], FFFFW
$EB $05				 #jmp short dobounce
#BounceRight:
$C7 $45 $0E $0001W	 #mov [di+object.xmotion, 1W
#dobounce:
$8B $45 $0E			 # mov     ax, [di+OBJECT.xmotion]
$BA $10 $00 		 # mov     dx, 10h
$F7 $EA     		 # imul    dx
$89 $45 $16 		 # mov     [di+OBJECT.xmove], ax
$C7 $45 $18 $FFD0W	 #mov [di+OBJECT.ymove], FFD0

$B8 $0010W  $50 $9A $187409F1RL $83 $C4 $02 #Play sound

#11208
$83 $7D $38 $00     #sideflags:      cmp     [di+OBJECT.rightflags], 0
$75 $06             #                jnz     short reverseX
$83 $7D $3C $00     #                cmp     [di+OBJECT.leftflags], 0
$74 $10             #                jz      short draw
$8B $45 $0E         #reverseX:       mov     ax, [di+OBJECT.xmotion]
$F7 $D8             #                neg     ax
$89 $45 $0E         #                mov     [di+OBJECT.xmotion], ax
$8B $45 $16         #                mov     ax, [di+OBJECT.xmove]
$F7 $D8             #                neg     ax
$89 $45 $16         #                mov     [di+OBJECT.xmove], ax
$FF $75 $20         #draw:           push    [di+OBJECT.zplane] ; int
$33 $C0             #                xor     ax, ax
$50                 #                push    ax              ; int
$FF $75 $1E         #                push    [di+OBJECT.chunk] ; value
$FF $75 $0C         #                push    [di+OBJECT.ypos] ; int
$FF $75 $0A         #                push    [di+OBJECT.xpos] ; int
$8B $C7 $05			#                mov     ax, di
$46 $00             #                add     ax, 46h
$50                 #                push    ax              ; int
$9A $16541641RL	    #                call    RF_PlaceSprite                     
$83 $C4 $0C         #                add     sp, 0Ch                            
$5F                 #                pop     di                                 
$5E                 #                pop     si                                 
$8B $E5             #                mov     sp, bp                             
$5D                 #                pop     bp                                 
$CB                 #                retf                                       

#Collision
#Bounder kills Keen, can be shot: 
%patch $11138 
$55 
$8B $EC 
$56 $57 
$8B $76 $06 						# mov	si, [bp+6]
$8B $7E $08							# mov	di, [bp+8] 
$83 $3D $02							# cmp	[di], 2 ; stunner
$75 $09 
$9A $0B8013E9RL $5F $5E $5D $CB		# call killkeen and return 
$83 $3D $03							# cmp [di], 3  ; stunner
$75 $1D 
$C7 $44 $16 $00 $00 
$C7 $44 $06 $01 $00 
$B8 $A8 $2F 
$50 
$57 
$56 
$9A $09DC1695RL 
$83 $C4 $06 
#$C7 $44 $00 $00 $01	# type = 01,  (obj_friendly)
$90 $90 $90 $90 $90
$5F $5E $5D $CB






#3 frame loop
%patch $32700
$1B8W $1B8W $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $38AEW 
$1B9W $1B9W $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $38CCW 
$1BAW $1BAW $4W $0W $0W $10W $0W $0W $10800D44RL $11A20D86RL $09DC176ERL $3890W 

#Collision Function
#altered so that mine does not blow up and does not make sound when contact keen

%patch $127B9 $90 $90 $90 $90 $90 #don't change action to explosion
%patch $127C5 $90 $90 $90 $90 $90 #don't play a sound





#actions
#2 movement actions (smooth movement always thinking)
%patch $3154E
$1C9W $1C9W $1W $1W $1W $4W $11W $0W $10800071RL $108000B0RL $10800100RL $26FCW 
$1C9W $1C9W $1W $1W $1W $4W $11W $0W $10800071RL $108000B0RL $10800100RL $26DEW 
$1C9W $1C9W $1W $1W $1W $4W $18W $0W $0L         $108000B0RL $10800100RL $2738W 
$1C9W $1C9W $1W $1W $1W $4W $18W $0W $0L         $108000B0RL $10800100RL $26DEW 

#attacking actions
#stunned action

#default movement think
#if player is close enough, go to attacking action.

#spawn -- set health
%patch $1081C
$C7 $47 $3E 02W			#mov [si+objtype.int31], 2

%patch $10836
$40W				# map units to move sprite down on spawn

%patch $10871 
#$10800071RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si
$8B $76 $06 			#mov si, [bp+6]


						#checky;
$8B $1E $A7D6W			# mov bx, [player]
$8B $47 $32				#mov ax, [bx+boxT.lr.y]
$2B $44 $32				#sub ax, [si+boxT.lr.y]
$3D $2W					#cmp ax, 2
$7F  34					#jg return
$3D $FFFEW	  			#cmp ax, -2
$7C  29					#jl return
						
						#checkx:
$8B $47 $2A				# mov ax, [bx+object.boxXmid]
$2B $44	$2A				# sub ax, [si+object.boxXmid]
$3D $200W 				#cmp ax, 0x200
$7F  18					#jg return
$3D $FE00W				#cmp ax, 0xFE00
$7C  13	  				#jl return
						
						#doattack:
$B8 $271AW				#mov ax, a_wormmouthattack1
$50						#push ax
$56						#push si
$9A $09DC120ARL			#call CheckGround2
$83 $C4 $04				#add sp, 4

						#return:
$5E	
$8B $E5 
$5D			#pop si; mov sp, bp; pop bp
$CB						#retf
						


#collision
#check for shots, decrease health, set whiteflash, die if health <0
%patch $108B0
#$108000B0RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si
$57						#push di
$8B $76 $06 			#mov si, [bp+6]
$8B $7E $08 			#mov di, [bp+8]

						#kill keen
$83 $3D $02				#cmp word ptr [di], 2
$75  07					#jnz checkstunner
$9A $0B8013E9RL			#call KeenDie
$EB  44					#jmp return

						#checkstunner:
$83 $3D $03				#cmp word ptr [di], 3
$75	 39					#jnz return
$57						#push di
$9A $0D8F0D43RL			#call StunnerZaps
$83 $C4 $02				#add sp, 2
$FF $4C $3E				#dec [si+obtype.int31]
$75  20					#jnz notdead

						#dead:
$C7 $44 $40 0W			#mov [si+int32], 0
$B8 $2882W				#mov ax, a_wormmouthstunned
$50						#push ax
$56						#push si
$9A $09DC120ARL			#call CheckGround2
$83 $C4 $04				#add sp, 4
$EB  05					#jmp return

#notdead:
$C7 $44 $40 5W			#mov [si+int32], WHITEFLASH

#return:
$5F $5E $8B $E5 $5D $CB	#pop di;pop si; mov sp, bp; pop bp; retf



#drawfunc (decrease whiteflash, draw white if != 0) 
%patch $10900
#$10800100RL
$55						#push bp
$8B $EC					#mov bp, sp
$56						#push si      
$8B $76 $06 			#mov si, [bp+6]

#Portion of DrawFunc2 that turns actor around at walls and edges
$83 $7C $0E $01
$75 $2B 
$83 $7C $3C $00 
$74 $25  
$8B $44 $12 
$29 $44 $0A 
$C7 $44 $0E $FF $FF 
$9A $1D02002ARL      
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C 
$56 
$9A $09DC120ARL		 
$83 $C4 $04 
$EB $5D 
$83 $7C $0E 
$FF $75 $2B 
$83 $7C $38 $00 
$74 $25 
$8B $44 $12 
$29 $44 $0A 
$C7 $44 $0E $01 $00 
$9A $1D02002ARL      
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C $56 
$9A $09DC120ARL 
$83 $C4 $04 
$EB $2C 
$83 $7C $36 $00 
$75 $26 
$8B $44 $12 
$29 $44 $0A  
$8B $44 $0E 
$F7 $D8 
$89 $44 $0E 
$9A $1D02002ARL     
$B1 $05 $D3 $F8 
$89 $44 $08 
$FF $74 $1C 
$56 
$9A $09DC120ARL 
$83 $C4 $04

# Start Drawing
$FF $74 $20				#push [si+objtype.zplane]
$33 $C0					#xor ax, ax
$83 $7C $40 $00				#cmp [si+objtype.int32], 0
$74 $04					#jz draw
$FF $4C $40				#dec [si+obtype.int32]
$40						#inc ax ; push 1


#draw:
$50						#push ax
$FF $74 $1E
$FF $74 $0C 
$FF $74 $0A 
$8B $C6 
$05 $46 $00 
$50 
$9A $16541641RL 
$83 $C4 $0C 

$5E	$8B $E5 $5D			#pop si; mov sp, bp; pop bp
$CB						#retf
I set up a test copy of The Sunnylands (Keen 4 levelpack where most patches are just for text), put the above patches into the patch file, and it works just fine!

As for making the Bounder only harmful when bouncing, I'm not really a patching expert, but I imagine it would be tricky to perform, even for talented patch-makers. I could be wrong, though.
Delightful! It works like a charm! Thanks a lot, Quillax!

In addition, I'd also like to ask if it's possible to make Bounders unkillable. I already tried adding the following piece of code (from the Galaxy patch-based tutorial):

Code: Select all

#Make Bounders un-stunnable
%patch $11166 $12 $2F 
Unfortunately, after adding it with the code you suggested, the game freezes when Keen shoots the Bounders.

Regarding making Bounders harmful for Keen only when jumping, I understand this might be tricky to implement; if so, it's okay to not create this kind of patch.
User avatar
Quillax
Posts: 28
Joined: Sun Mar 27, 2016 5:48 pm
Contact:

Re: Bounders act like a Toad

Post by Quillax »

I looked into it, then I saw the problem and managed to come up with a solution.

That patch you're trying to use is meant to overwrite code that seems to be for what to become when shot. It will work with the original Bounder code, but not the Dartfrog code since the function got moved to a different spot. To make the Dartfrog-like Bounder invincible, you'll want to use this patch:

Code: Select all

#Make Bounders un-stunnable (use with the Dartfrog patch from Atroxian Realm)
%patch $11161 $12 $2F 
Note that all I did was change the address. Also, make sure you put that patch after the entire Dartfrog patch. Alternatively, you can just search for "$B8 $A8 $2F" in the Dartfrog patch, and replace that line with "$B8 $12 $2F".

I've tested out both the patch and the line change, and it all works very well. I'll note, however, that the Bounder does have a noticeable reaction to Keen's shots. When you shoot a Bounder while it's hopping, it'll lose its horizontal momentum and drop straight down. Also, you can prevent it from hopping by constantly shooting at it. Are you okay with this, or would you rather if the Bounder didn't react at all?

I looked into seeing if it's possible to make the Bounder be totally unaffected by shots, and so far I've come up with this patch:

Code: Select all

#Shots don't affect Bounders while airborne (use with the Dartfrog patch from Atroxian Realm)
%patch $11157 $90 $90 $90 $90 $90 $90 $90 $90 $90
Again, you'll want to put that after the Dartfrog patch. I only managed to null out the effect when it's airborne; when a Bounder is shot while on the ground it still seems to reset its delay before hopping. I've tried removing that, but could not come up with a patch that works. As I've said before, I'm not a patching expert, so I'm not even sure where in the code it's doing that reset, if it's even programmed to reset (it could also be a consequence of other parts in the code). I'm guessing that the patch for making Bounders invincible makes it so that a Bounder becomes a Bounder rather than a "dead" Bounder when shot, so maybe it's doing the initialization code every time it becomes a Bounder?
User avatar
Alopex
Posts: 34
Joined: Thu Jun 15, 2017 7:27 pm
Location: Bloogfoods, Inc.

Re: Bounders act like a Toad

Post by Alopex »

Quillax wrote: Sun Oct 27, 2024 6:16 pm I looked into it, then I saw the problem and managed to come up with a solution.

That patch you're trying to use is meant to overwrite code that seems to be for what to become when shot. It will work with the original Bounder code, but not the Dartfrog code since the function got moved to a different spot. To make the Dartfrog-like Bounder invincible, you'll want to use this patch:

Code: Select all

#Make Bounders un-stunnable (use with the Dartfrog patch from Atroxian Realm)
%patch $11161 $12 $2F 
Note that all I did was change the address. Also, make sure you put that patch after the entire Dartfrog patch. Alternatively, you can just search for "$B8 $A8 $2F" in the Dartfrog patch, and replace that line with "$B8 $12 $2F".

I've tested out both the patch and the line change, and it all works very well. I'll note, however, that the Bounder does have a noticeable reaction to Keen's shots. When you shoot a Bounder while it's hopping, it'll lose its horizontal momentum and drop straight down. Also, you can prevent it from hopping by constantly shooting at it. Are you okay with this, or would you rather if the Bounder didn't react at all?

I looked into seeing if it's possible to make the Bounder be totally unaffected by shots, and so far I've come up with this patch:

Code: Select all

#Shots don't affect Bounders while airborne (use with the Dartfrog patch from Atroxian Realm)
%patch $11157 $90 $90 $90 $90 $90 $90 $90 $90 $90
Again, you'll want to put that after the Dartfrog patch. I only managed to null out the effect when it's airborne; when a Bounder is shot while on the ground it still seems to reset its delay before hopping. I've tried removing that, but could not come up with a patch that works. As I've said before, I'm not a patching expert, so I'm not even sure where in the code it's doing that reset, if it's even programmed to reset (it could also be a consequence of other parts in the code). I'm guessing that the patch for making Bounders invincible makes it so that a Bounder becomes a Bounder rather than a "dead" Bounder when shot, so maybe it's doing the initialization code every time it becomes a Bounder?
Wow! Thanks again for this valuable patch!

I chose the first one, which makes the Bounders react to Keen's shots. I think this is a fair way to counter them in the game, since they are now invulnerable to stuns.

Thanks a lot!
Post Reply