' scen/grab.txt - findings 2.6 and 2.7: catching a ledge, and hanging on it.
'
' CTRL.S fallon reaches for a ledge with
'     lda CharX / sta savekidx / lda #grabreach / jsr addcharx / sta CharX
' and grabreach is MINUS eight.  addcharx adds in the direction he faces, so
' the reach goes BACKWARDS; the port kept the sign in the code instead of the
' constant and stretched him forwards, putting the window sixteen pixels out.
'
' On a catch, fallon does
'     jsr getdist / jsr addcharx / sta CharX
' which puts his BASE on the block edge.  That is what makes CharBlockX the
' ledge column, and CTRL.S hanging then reads getabove and getunderft at
' CharBlockX for the whole of the hang.  The port aligned his coordinate
' rather than his base and then looked one block in front, which reads the gap
' for a left-facer and two past it for a right-facer.
'
' Level 1 screen 8's own gap is one block wide, and he steps off at its near
' edge, where reaching back lands him on the ledge he has just left - so the
' catch that is wanted here is the other one: a running jump that falls short.
' The gap is widened to four blocks, with somewhere to land under it, and he
' jumps into it and catches the far side.

SCEN a running jump that falls short catches the far ledge
AT 1 8 7 1
TYPE 8 1 1 0
TYPE 8 2 1 0
TYPE 8 3 1 0
TYPE 8 1 2 1
TYPE 8 2 2 1
SEED 17
RUN ..>>>>>>>>JFFFFFFFFFFFFFFFFF
WANT GRABS 1
WANT ACTION 2
WANT BX 0
WANT BY 2
WANT ALIVE 1
END

' And hanging there, up with the button still held climbs him onto the ledge
' he is holding - let go of the button and he drops instead.
SCEN and he climbs up onto it
AT 1 8 7 1
TYPE 8 1 1 0
TYPE 8 2 1 0
TYPE 8 3 1 0
TYPE 8 1 2 1
TYPE 8 2 2 1
SEED 17
RUN ..>>>>>>>>JFFFFFFFFFFFFFFFF
RUN UUUUUUUUUUUUUUUUUUUUUUUU
WANT GRABS 1
WANT CLIMBS 1
WANT BY 1
WANT ALIVE 1
END

' CTRLSUBS.S CHECKLEDGE has one test that needs the block's state and not
' just its type:
'     cmp #loose / bne :notloose
'     bit tempstate / bne :no  ;floor is already loose
' A loose floor that has begun to go is not something to hang from, and the
' port let him catch one on its way down - the one moment it is certainly not
' there to be caught.
'
' The same falling-short jump as above, with the ledge he reaches for made a
' loose floor.  Whole, he catches it; already on the move, he does not and
' lands where the fall was taking him.

SCEN a loose floor still whole can be caught
AT 1 8 7 1
TYPE 8 1 1 0
TYPE 8 2 1 0
TYPE 8 3 1 0
TYPE 8 1 2 1
TYPE 8 2 2 1
' (The block was a torch, and its flame state is left in the modifier byte by
' the type change, so it is cleared here rather than read as a floor already
' going.)
TYPE 8 0 1 11
SPEC 8 0 1 0
SEED 17
RUN ..>>>>>>>>JFFFFFFFFFFFFFFFFF
WANT GRABS 1
WANT BX 0
WANT BY 2
END

SCEN one already on its way down cannot
AT 1 8 7 1
TYPE 8 1 1 0
TYPE 8 2 1 0
TYPE 8 3 1 0
TYPE 8 1 2 1
TYPE 8 2 2 1
TYPE 8 0 1 11
SPEC 8 0 1 1
SEED 17
RUN ..>>>>>>>>JFFFFFFFFFFFFFFFFF
WANT GRABS 0
WANT BY 2
WANT ALIVE 1
END
