Prev: A4FF Up: Map Next: A623
A53D: Routine at A53D
Used by the routine at Action_a3d0.
Input
Output
_a53d A53D LD IX,(Actor_CurrentPtr)
A541 LD HL,(People_TempCoordNS)
A544 LD E,(IX+$05)
A547 LD D,(IX+$06)
A54A LD C,$00
A54C AND A
A54D SBC HL,DE
A54F JR C,_a53d_0
A551 LD C,$02
_a53d_0 A553 LD HL,(People_TempCoordEW)
A556 LD E,(IX+$07)
A559 LD D,(IX+$08)
A55C LD B,$03
A55E AND A
A55F SBC HL,DE
A561 JR C,_a53d_1
A563 LD B,$01
_a53d_1 A565 LD A,(Temp_DirCompass)
A568 BIT 0,A
A56A JR Z,_a53d_2
A56C LD A,C
A56D LD C,B
A56E LD B,A
_a53d_2 A56F LD (_a193),BC
A573 LD A,(Temp_DirCompass)
A576 XOR $01
A578 CALL Person_GetCoordsForTesting See if coordinats is on a path.
A57B LD HL,$0000
A57E LD ($5BF0),HL
A581 CALL Path_FindByCoord
A584 JR C,_a53d_4 Skip if test failed.
A586 LD ($5BF0),IX Store address of path found.
Get the distance of the junctions either side.
A58A LD A,(Temp_DirCompass) Convert camera compass into direction.
A58D XOR $01
A58F CALL Actor_NearestJunctions Calculate distances of junctions.
A592 LD HL,(DistanceA)
A595 LD DE,(DistanceB)
A599 LD A,(_a193)
A59C CP $00
A59E JR Z,_a53d_3
A5A0 CP $03
A5A2 JR Z,_a53d_3
A5A4 EX DE,HL
_a53d_3 A5A5 LD ($5BF2),HL
A5A8 LD ($5BF4),DE
A5AC LD A,L
A5AD OR H
A5AE JR Z,_a53d_4
A5B0 LD IX,($5BF0)
A5B4 LD A,(Temp_DirCompass)
A5B7 XOR $01
A5B9 LD B,$00
A5BB LD C,$03
A5BD JP Action_a3d0_5
_a53d_4 A5C0 LD HL,(Temp_PathPtr)
A5C3 LD A,L
A5C4 OR H
A5C5 JR Z,_a53d_7
Calculate distant of junctions.
A5C7 LD IX,(Temp_PathPtr)
A5CB LD A,(Temp_DirCompass)
A5CE CALL Actor_NearestJunctions
A5D1 LD HL,(DistanceA)
A5D4 LD DE,(DistanceB)
A5D8 LD A,(_a194)
A5DB CP $00
A5DD JR Z,_a53d_5
A5DF CP $03
A5E1 JR Z,_a53d_5
A5E3 EX DE,HL
_a53d_5 A5E4 LD (Temp_DistanceA),HL
A5E7 LD (Temp_DistanceB),DE
A5EB LD A,L
A5EC OR H
A5ED JR Z,_a53d_6
A5EF LD IX,(Temp_PathPtr)
A5F3 LD A,(Temp_DirCompass)
A5F6 LD B,$00
A5F8 LD C,$03
A5FA JP Action_a3d0_5
_a53d_6 A5FD EX DE,HL
A5FE LD A,L
A5FF OR H
A600 JR Z,_a53d_7
A602 LD IX,(Temp_PathPtr)
A606 LD A,(Temp_DirCompass)
A609 LD B,$02
A60B LD C,$01
A60D JP Action_a3d0_5
_a53d_7 A610 LD IX,($5BF0)
A614 LD HL,($5BF4)
A617 LD A,(Temp_DirCompass)
A61A XOR $01
A61C LD B,$02
A61E LD C,$01
A620 JP Action_a3d0_5
Prev: A4FF Up: Map Next: A623