Prev: A3D0 Up: Map Next: A53D
A4FF: Routine at A4FF
Used by the routine at People_DecideAction.
Input
IX Pointer to current person.
HL
Output
_a4ff_People A4FF LD A,(IX+$16) Get action index
A502 CP $02
A504 JR Z,_a4ff_People_0
A506 CP $06
A508 JR NZ,_a4ff_People_1
_a4ff_People_0 A50A LD (IX+$0D),$01 Wait for one cycle.
_a4ff_People_1 A50E LD A,(IY+$3E) Use time for random number.
A511 AND $7F
A513 ADD A,$0A
A515 CP L If new value is less than existing, use it.
A516 JR C,_a4ff_People_2
A518 LD A,L If existing is not zero, use that instead.
_a4ff_People_2 A519 AND A
A51A JR NZ,_a4ff_People_3
A51C LD A,$20 Else default to $20
_a4ff_People_3 A51E LD (IX+$0A),A Set as action countdown.
A521 LD E,A
A522 LD D,$00
A524 AND A
A525 SBC HL,DE
A527 JR Z,_a4ff_People_4
A529 LD A,(IX+$16) If using action other than $0a, set waiting time.
A52C CP $0A
A52E JR Z,_a4ff_People_4
A530 LD (IX+$0D),$1E
_a4ff_People_4 A534 LD (IX+$14),L
A537 LD (IX+$15),H
A53A JP Person_MoveForward_0
Prev: A3D0 Up: Map Next: A53D