Prev: 82CB Up: Map Next: 8456
82F1: Routine at 82F1
SidheMove_DataFrame 82F1 LD BC,$E413 Frame counter (0 or 1). Sidhe moves when 1.
82F2 INC DE
82F3 CALL PO,$E421
This entry point is used by the routines at Vectors and SidheUpdate.
SideMove 82F6 LD A,(SidheMove_DataFrame) Only handle every other frame.
82F9 XOR $01
82FB LD (SidheMove_DataFrame),A
82FE RET Z
82FF LD IX,(Baddy_LinkPtr)
8303 LD A,(IX+$0F)
8306 AND A
8307 JR Z,SidheMove_DataFrame_0
8309 DEC (IX+$0F)
830C RET
SidheMove_DataFrame_0 830D LD A,(IX+$0A) Decrease moves left. If zero then check to see where to move next.
8310 AND A
8311 JP Z,SidheMove_WhatNext
8314 DEC (IX+$0A)
8317 INC (IX+$0C)
831A LD A,(IX+$0B)
831D INC A
831E CP $BB
8320 JR C,SidheMove_DataFrame_1
8322 LD A,$B4
SidheMove_DataFrame_1 8324 LD (IX+$0B),A
8327 LD A,(IX+$02) Get direction.
832A BIT 0,A
832C JR Z,SidheMove_DataFrame_2
832E LD E,(IX+$07) Get E/W position
8331 LD D,(IX+$08)
8334 JR SidheMove_DataFrame_3
SidheMove_DataFrame_2 8336 LD E,(IX+$05) Get N/S position
8339 LD D,(IX+$06)
Move in the correct direction.
SidheMove_DataFrame_3 833C CP $00 Moving north?
833E JR Z,SidheMove_DataFrame_4
8340 CP $03 Moving west?
8342 JR Z,SidheMove_DataFrame_4
8344 INC DE
8345 JR SidheMove_DataFrame_5
SidheMove_DataFrame_4 8347 DEC DE
SidheMove_DataFrame_5 8348 BIT 0,A Test compass for N/E
834A JR Z,SidheMove_DataFrame_6
834C LD (IX+$07),E
834F LD (IX+$08),D
8352 JR SidheMove_DataFrame_7
SidheMove_DataFrame_6 8354 LD (IX+$05),E
8357 LD (IX+$06),D
N
SidheMove_DataFrame_7 835A LD A,(DeathMode)
835D AND A
835E RET NZ
835F LD A,(IX+$0E)
8362 AND A
8363 JR Z,SidheMove_Near
8365 LD L,(IX+$05)
8368 LD H,(IX+$06)
836B LD DE,$00B4
836E AND A
836F SBC HL,DE
8371 RET NZ
8372 LD L,(IX+$07)
8375 LD H,(IX+$08)
8378 LD DE,$0180
837B AND A
837C SBC HL,DE
837E RET NZ
837F XOR A
8380 LD (IX+$0E),A
8383 LD (IX+$0A),A
8386 LD HL,$00B6
8389 LD (IX+$05),L
838C LD (IX+$06),H
838F LD HL,$00B8
8392 LD (IX+$07),L
8395 LD (IX+$08),H
8398 RET
SidheMove_Near 8399 LD HL,(ManData_PosPrimary_dfc3) See if the sidhe is with $14 units of the man.
839C LD E,(IX+$05)
839F LD D,(IX+$06)
83A2 CALL Vector_ABS(hl_minus_de)
83A5 LD BC,$0014
83A8 AND A
83A9 SBC HL,BC
83AB JR NC,SidheMove_Exit
83AD ADD HL,BC
83AE PUSH HL
83AF LD HL,(ManData_PosSecondary_dfc5) Check again with the E/W position.
83B2 LD E,(IX+$07)
83B5 LD D,(IX+$08)
83B8 CALL Vector_ABS(hl_minus_de)
83BB POP DE
83BC AND A
83BD SBC HL,BC
83BF JR NC,SidheMove_Exit
83C1 ADD HL,BC
83C2 PUSH HL
83C3 PUSH DE
83C4 LD A,(IX+$0D) See if the warning message has already been displayed.
83C7 AND A
83C8 JR NZ,SidheMove_DataFrame_8
83CA LD (IX+$0D),$01 If not display it and set the flag.
83CE CALL Vector_DisplayWarning
83D1 DEFM "sidhe!"
83D7 LD E,(HL)
SidheMove_DataFrame_8 83D8 CALL $826E
83DB POP DE
83DC POP HL
83DD LD BC,$0006
83E0 AND A
83E1 SBC HL,BC
83E3 RET NC
83E4 EX DE,HL
83E5 AND A
83E6 SBC HL,BC
83E8 RET NC
83E9 LD A,(AreaDataCurrent_Index)
83EC CP $03
83EE JR NZ,SidheMove_DataFrame_9
83F0 LD A,($DFCE)
83F3 BIT 5,A
83F5 JR Z,SidheMove_DataFrame_9
83F7 LD (IX+$0E),$01
83FB CALL Vector_DisplayWarning
83FE LD E,(HL)
83FF RET
SidheMove_DataFrame_9 8400 LD A,(ThruDoorCounter_E004)
8403 AND A
8404 RET NZ
8405 LD A,$01
8407 LD (DeathMode),A
840A XOR A
840B LD (ThruDoorGo_E005),A
840E RET
SidheMove_Exit 840F DEFB $DD,$36,$0D,$00,$C9 Clear message flag
SidheMove_WhatNext 8414 DEFB $DD,$7E,$0E,$A7,$28,$3C,$2A,$C3 Decide what to do next
841C DEFB $DF,$E5,$2A,$C5,$DF,$E5,$2A,$DA
8424 DEFB $DF,$E5,$3A,$DC,$DF,$F5,$21,$B4
842C DEFB $00,$22,$C3,$DF,$21,$80,$01,$22
8434 DEFB $C5,$DF,$2A,$0D,$E0,$22,$DA,$DF
843C DEFB $3A,$0F,$E0,$32,$DC,$DF,$CD,$56
8444 DEFB $84,$F1,$32,$DC,$DF,$E1,$22,$DA
844C DEFB $DF,$E1,$22,$C5,$DF,$E1,$22,$C3
8454 DEFB $DF,$C9
Prev: 82CB Up: Map Next: 8456