Prev: 7DCB Up: Map Next: 7EDD
7DD4: Path : Find path that player is on.
Used by the routines at Room_Initialise and Skar_View.
Input
Output
Path_Find 7DD4 XOR A
7DD5 LD (PathFound_IndexCount),A
Get correct position based on compass.
7DD8 LD DE,(Coords_NS)
7DDC LD HL,(Coords_EW)
7DDF LD A,(Camera_Compass) Check to E/W compass.
7DE2 AND $01
7DE4 JR NZ,Path_Find_0
7DE6 LD IX,(CurrentRoom_Ptr_Path_EW) N/W facing.
7DEA JR Path_Find_1
Path_Find_0 7DEC LD IX,(CurrentRoom_Ptr_Path_NS) E/W facing, swap round coords.
7DF0 EX DE,HL
Path_Find_1 7DF1 LD A,(Flag_DoorEntry)
7DF4 AND A
7DF5 JR Z,Path_Find_4
7DF7 LD A,(Camera_Compass)
7DFA LD BC,$0006
7DFD CP $02
7DFF JR C,Path_Find_2
7E01 LD BC,$FFFA
Path_Find_2 7E04 LD A,(Hero_LastDirection)
7E07 CP $02
7E09 JR Z,Path_Find_3
7E0B ADD HL,BC
7E0C JR Path_Find_4
Path_Find_3 7E0E AND A
7E0F SBC HL,BC
Find path player is on.
Path_Find_4 7E11 LD C,L
7E12 LD B,H
Path_Find_5 7E13 PUSH DE
7E14 LD L,(IX+$00) Match path axis.
7E17 LD H,(IX+$01)
7E1A AND A
7E1B SBC HL,DE
7E1D JR NC,Path_Find_6 Move not next path is not same position.
7E1F LD DE,$0004
7E22 AND A
7E23 ADC HL,DE
7E25 JP M,Path_Find_8
7E28 JR Path_Find_7
Path_Find_6 7E2A LD DE,$0004
7E2D SCF
7E2E SBC HL,DE
7E30 JR NC,Path_Find_9
Path_Find_7 7E32 LD L,(IX+$02) See if player is within the two ends of the path.
7E35 LD H,(IX+$03)
7E38 SCF
7E39 SBC HL,BC
7E3B JR NC,Path_Find_8
7E3D LD L,(IX+$04)
7E40 LD H,(IX+$05)
7E43 AND A
7E44 SBC HL,BC
7E46 JR NC,Path_Find_11
Next path.
Path_Find_8 7E48 LD HL,PathFound_IndexCount
7E4B INC (HL)
7E4C LD DE,$000C
7E4F ADD IX,DE
7E51 POP DE
7E52 JR Path_Find_5
Path found, running in and out of screen.
Path_Find_9 7E54 POP DE
7E55 LD DE,(Coords_NS)
7E59 LD HL,(Coords_EW)
7E5C LD A,(Camera_Compass)
7E5F BIT 0,A
7E61 JR Z,Path_Find_10
7E63 EX DE,HL
Path_Find_10 7E64 LD (PathFound_InOut_Axis),DE
7E68 LD DE,$0004
7E6B AND A
7E6C SBC HL,DE
7E6E LD (PathFound_InOut_Start),HL
7E71 ADD HL,DE
7E72 ADD HL,DE
7E73 LD (PathFound_InOut_End),HL
7E76 LD IX,PathFound_InOut_Axis
7E7A LD (Hero_PathPtr),IX
7E7E LD (PathFound_Compass),A
7E81 JR Path_Find_13
Path found, running left and right of screen.
Path_Find_11 7E83 POP DE
7E84 LD (Hero_PathPtr),IX
7E88 LD A,(Camera_Compass)
7E8B LD (PathFound_Compass),A
7E8E LD (PathFound_PathPtr),IX
7E92 LD ($B16A),A
7E95 LD A,(Camera_Compass)
7E98 LD L,(IX+$00)
7E9B LD H,(IX+$01)
7E9E BIT 0,A
7EA0 JR Z,Path_Find_12
7EA2 LD (Coords_EW),HL
7EA5 JR Path_Find_13
Path_Find_12 7EA7 LD (Coords_NS),HL
Path_Find_13 7EAA LD DE,$0022 Get the ends of the path and include a margin for the width of the screen to allow for overruns when drawing the screen.
7EAD LD L,(IX+$02)
7EB0 LD H,(IX+$03)
7EB3 AND A
7EB4 SBC HL,DE
7EB6 SET 7,H
7EB8 LD (PathFound_StartMargin),HL
7EBB LD L,(IX+$04)
7EBE LD H,(IX+$05)
7EC1 ADD HL,DE
7EC2 SET 7,H
7EC4 LD (PathFound_EndMargin),HL
Get background data.
7EC7 BIT 1,A Determine which background to use based on camera direction.
7EC9 JR NZ,Path_Find_14
7ECB LD L,(IX+$06) North / East background.
7ECE LD H,(IX+$07)
7ED1 JR Path_Find_15
Path_Find_14 7ED3 LD L,(IX+$08) South / West background.
7ED6 LD H,(IX+$09)
Path_Find_15 7ED9 LD (PathFound_BackgroundPtr),HL
7EDC RET
Prev: 7DCB Up: Map Next: 7EDD