;walk Button
;----------------------------------
lorom
	
org $9181F4	;hijack keybind translation
	JSL $90F640 : NOP : NOP : NOP
	
	
org $90F640	;invert the run bit unless on xray or in intro cinematics
	LDA $09D2 : CMP #$0005 : BEQ XRAY : LDA $0998 : CMP #$001E : BEQ XRAY
	LDA $8B : EOR $09B6 : STA $8B
	
XRAY:
	LDA $8F : AND #$0F00 : STA $12
	RTL
XRAY_HANDLER_DELAY:	;delay xray startup for a frame to avoid conflicts
	LDA $0A0E : CMP #$0005 : BNE +
	JSL $91CAD6
	+
	RTL
	
org $90DDD3	;hijack xray startup
	JSL XRAY_HANDLER_DELAY

;-------------------------------------------------------------------
;OPTION TILEMAPS

org $82F00C		;hijack the option screen game loop, fading in.
	JSR $F710

org $82F710		;replace Dash with Walk. Could probably do this in a more efficient way.
PHY
LDX #$0000
-
LDA WALK_MAPS,x
STA $7E32CC,x
INX : INX
CPX #$0008 : BMI -

LDX #$0000
LDY #$0008
-
LDA WALK_MAPS,y
STA $7E330C,x
INX : INX : INY : INY
CPX #$0008 : BMI -

PLY
STZ $099E
RTS

WALK_MAPS:
DW $002F, $000A, $0025, $0024
DW $003F, $001A, $0035, $0034
