Prev: 757C Up: Map Next: 7663
7580: Check for leaving the area.
ExitArea_ExitIndex 7580 DEFB $00,$01 Exit Test variables.
See if man is within a 20 units margin on the boundary of the area.
ExitAreaCheck 7582 DEFB $2A,$C3,$DF,$ED,$5B,$C5,$DF,$3A Get current position on map.
758A DEFB $D2,$DF
758C DEFB $CB,$47,$20,$01,$EB Use the axis that hero is walking on. (If cam==N then use east/west).
See if man is on boundary of area - Exit if not.
7591 DEFB $CB,$4F,$28,$14 Test for N/E or S/W facing.
7595 DEFB $3A,$D4,$DF,$FE,$02,$28,$14 Test to see which way man is facing.
759C DEFB $01,$27,$00,$A7,$ED,$42 Facing right.
75A2 DEFB $F0 Exit if position is > $27
75A3 DEFB $01,$21,$00,$09,$18,$17 Offset position value again.
75A9 DEFB $3A,$D4,$DF,$FE,$02,$28,$EC Test to see which way man is facing.
75B0 DEFB $01,$DA,$01,$A7,$ED,$42 Facing right.
75B6 DEFB $F8 Exit if position < $01da
75B7 DEFB $09,$4D,$44,$21,$FA,$01,$A7,$ED Offset position value again.
75BF DEFB $42
Is on boundary, see which area is next.
ExitArea_OnBoundary 75C0 PUSH DE
75C1 PUSH HL
75C2 DEFB $21,$C3,$DF,$11,$7C,$75,$01,$04 Store current positions.
75CA DEFB $00,$ED,$B0
75CD DEFB $3A,$DD,$DF,$32,$81,$75 Store current area index.
75D3 DEFB $3A,$D4,$DF,$F6,$01,$2A,$D2,$DF Using direction and compass we can workout the direction man is leaving an area.
75DB DEFB $85,$E6,$03
75DE DEFB $32,$80,$75,$6F,$26,$00,$01,$EF Store as 'exit index'.
75E6 DEFB $DF,$09
75E8 DEFB $7E,$A7 Get index of area the path exit leads to.
75EA DEFB $28,$73 zero means no exit. Do nothing.
75EC DEFB $CD,$3C,$5E,$D1,$3A,$D2,$DF,$CB Get information on new area by temporary storing in heros information.
75F4 DEFB $4F,$20,$0D,$3A,$D4,$DF,$FE,$02
75FC DEFB $20,$0D,$21,$FA,$01,$19,$18,$0D
7604 DEFB $3A,$D4,$DF,$FE,$02,$20,$F3,$21
760C DEFB $06,$00,$A7,$ED,$52,$EB,$3A,$D4
7614 DEFB $DF,$F6,$01,$ED,$4B,$D2,$DF,$81
761C DEFB $E6,$03,$EE,$02,$ED,$4B,$80,$75
7624 DEFB $A9,$FE,$02,$28,$11,$FE,$03,$28
762C DEFB $0D,$21,$00,$02,$C1,$03,$03,$A7
7634 DEFB $ED,$42,$2B,$2B,$18,$01,$E1,$3A
763C DEFB $D2,$DF,$CB,$47,$28,$01,$EB,$22
7644 DEFB $C3,$DF,$ED,$53,$C5,$DF
764A DEFB $E1,$CD,$2F,$6D Get calling function from stack and retrn back as a call.
Get back originally stored position info.
764E LD HL,$757C
7651 LD DE,ManData_PosPrimary_dfc3
7654 LD BC,$0004
7657 LDIR
7659 DEFB $3A,$81,$75,$C3,$3C,$5E,$E1,$D1 Get temp stored area index (current) and update as current area.
7661 DEFB $E1,$C9
Prev: 757C Up: Map Next: 7663