;IBJ Prevention by person701
;After the defined amount of bomb jumps, bombs give out, no longer propelling you upward.
;Every bomb jump, a counter is increased by 1, and is set to 0 upon touching the ground.
;By default, bomb jumps won't work from mid-air morphs. It's possible to remove this feature by commenting out two lines.
;I did do a slight no-no in using the last two bytes of RAM for enemy 1F, but that should only cause problems if a room has 1F enemies in it.

lorom

!COUNT = $1776	;DON'T CHANGE THIS
;You can change the below value. Sets how many bomb jumps you can do before touching the ground agian. #$0003 allows for double bomb jumping. Anything lower only allows for single bomb jumping.
!BOMBS = #$0003
	
org $91F1E2
	JSR $EE10
	
org $91EE10		;prevent abuse of the bomb jump counter
	STZ !COUNT
	STZ $0B36
	RTS
	
org $A0984B
	JSR $F7F0
	
;Comment the LDA $0B36 and BEQ + below to allow bombs to affect you from a mid-air morph
org $A0F7F0
	PHA
	LDA $0B36
	BEQ +
	LDA !COUNT
	BEQ ++
	+
	LDA !COUNT
	CMP !BOMBS
	BEQ ++
	INC A
	STA !COUNT
	PLA
	STA $0A56
	RTS
	++
	PLA
	STZ !COUNT
	STZ $0A56
	RTS