Prev: A3CC Up: Map Next: A4FF
A3D0: Action:
Used by the routines at Action_a, Action_d, Action_e and Action_h.
Input
Output
Action_a3d0 A3D0 LD A,(IX+$18)
A3D3 LD (_a19e),A
A3D6 LD L,(IX+$0F)
A3D9 LD H,$00
A3DB ADD HL,HL
A3DC ADD HL,HL
A3DD ADD HL,HL
A3DE LD DE,RoomCurrent_RoomStructCopy
A3E1 ADD HL,DE
A3E2 LD DE,_5be6_PathEW
A3E5 LD BC,$0004
A3E8 LDIR
A3EA LD L,(IX+$0E) value[Person type]
A3ED LD H,$00
A3EF ADD HL,HL
A3F0 LD DE,Ptr_PersonLinkList
A3F3 ADD HL,DE
A3F4 LD (_a197),HL
A3F7 XOR A
A3F8 LD (HL),A
A3F9 INC HL
A3FA LD (HL),A
A3FB LD A,(Temp_DirCompass) Get the address of the path person is on.
A3FE CALL Person_GetCoordsForTesting
A401 LD HL,$0000
A404 LD (Temp_PathPtr),HL
A407 CALL Path_FindByCoord
A40A JP C,_a53d
A40D LD (Temp_PathPtr),IX Store address if path found.
A411 LD C,(IX+$00) Get axis of path
A414 LD B,(IX+$01)
A417 LD HL,(People_TempCoordNS) Stored coordinates.
A41A LD DE,(People_TempCoordEW)
A41E LD A,(Temp_DirCompass) Get direction
A421 BIT 0,A
A423 JR Z,Action_a3d0_0
A425 EX DE,HL Swap axis and vector for E/W
Action_a3d0_0 A426 AND A
A427 SBC HL,BC
A429 JP NZ,_a53d
A42C LD L,(IX+$02) Check vector is between end 'A' of path...
A42F LD H,(IX+$03)
A432 SCF
A433 SBC HL,DE
A435 JP NC,_a53d
A438 LD L,(IX+$04) ...and end 'B' of path.
A43B LD H,(IX+$05)
A43E AND A
A43F SBC HL,DE
A441 JP C,_a53d
A444 LD IX,(Actor_CurrentPtr)
A448 BIT 0,A
A44A JR NZ,Action_a3d0_1
A44C LD L,(IX+$07)
A44F LD H,(IX+$08)
A452 JR Action_a3d0_2
Action_a3d0_1 A454 LD L,(IX+$05)
A457 LD H,(IX+$06)
Action_a3d0_2 A45A CALL sub_abs
A45D JP Z,_a53d
A460 LD (IX+$0D),$01
A464 INC (IX+$16)
A467 LD A,(IX+$16)
A46A CP $0D
A46C JR Z,Action_a3d0_3
A46E CP $0F
A470 JR NZ,Action_a3d0_4
Action_a3d0_3 A472 LD HL,$0002
Action_a3d0_4 A475 LD IX,(Temp_PathPtr)
A479 LD A,(Temp_DirCompass)
A47C LD B,$00
A47E LD C,$03
This entry point is used by the routine at _a53d.
Action_a3d0_5 A480 LD (DistanceB),HL
A483 LD L,(IX+$00)
A486 LD H,(IX+$01)
A489 PUSH IX Store path address.
A48B POP DE
A48C LD IX,(_a197)
A490 LD (IX+$00),E
A493 LD (IX+$01),D
A496 LD IX,(Actor_CurrentPtr) Store for current player as well.
A49A LD (IX+$11),E
A49D LD (IX+$12),D
A4A0 LD E,A
A4A1 LD A,(IX+$11) Return if no path found.
A4A4 OR D
A4A5 RET Z
A4A6 LD A,E Check person's camera / compass.
A4A7 BIT 0,A
A4A9 JR Z,Action_a3d0_6
N/S facing.
A4AB LD (IX+$07),L Store as E/W coord.
A4AE LD (IX+$08),H
A4B1 LD E,(IX+$05) Get N/S coord.
A4B4 LD D,(IX+$06)
A4B7 LD HL,(People_TempCoordNS)
A4BA LD A,B
A4BB JR Action_a3d0_7
E/W facing.
Action_a3d0_6 A4BD LD (IX+$05),L Store as N/S coord.
A4C0 LD (IX+$06),H
A4C3 LD E,(IX+$07) Get E/W coord.
A4C6 LD D,(IX+$08)
A4C9 LD HL,(People_TempCoordEW)
A4CC LD A,C
Difference...
Action_a3d0_7 A4CD AND A Passed the target?
A4CE SBC HL,DE
A4D0 JR C,Action_a3d0_8
A4D2 XOR $02 Yes, reverse direction.
Action_a3d0_8 A4D4 LD H,(IX+$02)
A4D7 LD (IX+$02),A
A4DA LD L,(IX+$13) Clear flags (7) ?????
A4DD RES 7,L
A4DF XOR $02 Was previous temp direction same as current direction...
A4E1 CP H
A4E2 JR NZ,Action_a3d0_9
A4E4 LD A,(IX+$16) And current action is (1)..
A4E7 CP $01
A4E9 JR NZ,Action_a3d0_9
A4EB SET 7,L Then set flag (7).
A4ED LD A,L
A4EE CP (IX+$13) If the same as current flags...
A4F1 JR NZ,Action_a3d0_9
A4F3 LD (IX+$16),$0A Set next action as (A)
A4F7 RES 7,L and reset flag (7)
Action_a3d0_9 A4F9 LD (IX+$13),L Store new flags value.
A4FC LD HL,(DistanceB)
Prev: A3CC Up: Map Next: A4FF