Prev: 40504 Up: Map Next: 40826
40757: CrewAction7_Handler
Action-state 7 handler dispatched from CrewActionDispatch (33876, entry index 7). Called via JP (HL) from 36014. Calls 37876 to update the sprite position, then walks the two nearest-crew slots (33696 and 33697) — if either crew member is still alive, decrements one of the per-crew counters at offset -3 from its alive flag and, depending on the value, either jumps to 39400 or initiates a 29-step approach via 37176. Returns without further action if both nearest-crew entries are dead or absent (255).
40757 CALL 37876
40760 LD A,(33696)
40763 CP 255
40765 JR Z,40782
40767 LD C,A
40768 ADD A,A
40769 ADD A,A
40770 ADD A,A
40771 LD E,A
40772 LD D,0
40774 LD HL,29573
40777 ADD HL,DE
40778 XOR A
40779 CP (HL)
40780 JR Z,40802
40782 LD A,(33697)
40785 CP 255
40787 RET Z
40788 LD C,A
40789 ADD A,A
40790 ADD A,A
40791 ADD A,A
40792 LD E,A
40793 LD D,0
40795 LD HL,29573
40798 ADD HL,DE
40799 XOR A
40800 CP (HL)
40801 RET NZ
40802 DEC HL
40803 DEC HL
40804 DEC HL
40805 DEC (HL)
40806 LD A,(HL)
40807 CP 2
40809 JP C,39400
40812 CP 4
40814 RET NC
40815 LD L,C
40816 LD A,(33703)
40819 LD H,A
40820 LD A,29
40822 CALL 37176
40825 RET
Prev: 40504 Up: Map Next: 40826