| TirNaNog | Routines |
| Prev: 60EF | Up: Map | Next: 61B8 |
|
Used by the routines at 61B8 and ScreenUpdate.
|
||||
| PathIntersect | 60FD | LD DE,(ManData_PosPrimary_dfc3) | ||
| 6101 | LD HL,(ManData_PosSecondary_dfc5) | |||
| 6104 | LD A,(CamDirection_DFD2) | Depending on the camera, decide which path data to use. | ||
| 6107 | AND $01 | |||
| 6109 | JR NZ,PathIntersect_0 | |||
| 610B | LD IX,(AreaDataCurrent_Path_H) | |||
| 610F | JR PathIntersect_1 | |||
| PathIntersect_0 | 6111 | LD IX,(AreaDataCurrent_Path_V) | ||
| 6115 | EX DE,HL | |||
| PathIntersect_1 | 6116 | LD A,(ThruDoorCounter_E004) | ||
| 6119 | AND A | |||
| 611A | JR Z,PathIntersect_4 | |||
| 611C | LD A,(CamDirection_DFD2) | Since man is currently walking through a doorway, offset position by +/-6 units. | ||
| 611F | LD BC,$0006 | |||
| 6122 | CP $02 | |||
| 6124 | JR C,PathIntersect_2 | |||
| 6126 | LD BC,$FFFA | |||
| PathIntersect_2 | 6129 | LD A,(ManWalkDirection_DFD4) | ||
| 612C | CP $02 | |||
| 612E | JR Z,PathIntersect_3 | |||
| 6130 | ADD HL,BC | |||
| 6131 | JR PathIntersect_4 | |||
| PathIntersect_3 | 6133 | AND A | ||
| 6134 | SBC HL,BC | |||
| PathIntersect_4 | 6136 | LD C,L | BC now holds offset position. Store original position on stack. Remember this is either the X coord or Y coord depending on the camera. | |
| 6137 | LD B,H | |||
|
See if any paths, in the list, intersects the man's position.
|
||||
| TestPath | 6138 | PUSH DE | ||
| 6139 | LD A,(IX+$00) | Get the area index of path, if not the same as man then skip this path. | ||
| 613C | AND A | |||
| 613D | JR Z,PathIntersect_5 | |||
| 613F | LD HL,AreaDataCurrent_Index | |||
| 6142 | CP (HL) | |||
| 6143 | JR NZ,NextPath | |||
|
Get Path Axis Position
|
||||
| PathIntersect_5 | 6145 | LD A,(IX+$01) | Get start position of path | |
| 6148 | CP $FF | End if Terminate Code (0xFF) | ||
| 614A | JR Z,StoreNoPath | |||
| 614C | LD L,A | (pos x 2) to scale upto real units. | ||
| 614D | LD H,$00 | |||
| 614F | ADD HL,HL | |||
| 6150 | AND A | Get distance from man's position. | ||
| 6151 | SBC HL,DE | |||
| 6153 | JR NC,PathIntersect_6 | If >= man's position... | ||
| 6155 | LD DE,$0004 | |||
| 6158 | AND A | |||
| 6159 | ADC HL,DE | |||
| 615B | JP M,NextPath | |||
| 615E | JR PathIntersect_7 | |||
| PathIntersect_6 | 6160 | LD DE,$0004 | ||
| 6163 | SCF | |||
| 6164 | SBC HL,DE | |||
| 6166 | JR NC,StoreNoPath | |||
|
Get Path End(1) Position
|
||||
| PathIntersect_7 | 6168 | LD L,(IX+$02) | ||
| 616B | LD H,$00 | |||
| 616D | ADD HL,HL | |||
| 616E | SCF | |||
| 616F | SBC HL,BC | |||
| 6171 | JR NC,NextPath | |||
|
Get Path End(2) Position
|
||||
| 6173 | LD L,(IX+$03) | |||
| 6176 | LD H,$00 | |||
| 6178 | ADD HL,HL | |||
| 6179 | AND A | |||
| 617A | SBC HL,BC | |||
| 617C | JR NC,PathIntersect_8 | |||
|
Next Path
|
||||
| NextPath | 617E | LD DE,$0004 | ||
| 6181 | ADD IX,DE | |||
| 6183 | POP DE | |||
| 6184 | JR TestPath | |||
|
Store 'No Path'
|
||||
| StoreNoPath | 6186 | POP DE | ||
| 6187 | LD HL,$5E5A | |||
| 618A | LD (CurrentPathPtr),HL | |||
| 618D | LD A,(CamDirection_DFD2) | |||
| 6190 | LD ($DFD9),A | |||
| 6193 | RET | |||
|
Path Found
|
||||
| PathIntersect_8 | 6194 | POP DE | ||
| 6195 | LD (CurrentPathPtr),IX | Store path address. | ||
| 6199 | LD A,(CamDirection_DFD2) | |||
| 619C | LD ($DFD9),A | |||
| 619F | LD (PathScopes_DFDA),IX | |||
| 61A3 | LD ($DFDC),A | |||
| 61A6 | LD L,(IX+$01) | Make sure man is positioned correctly on path axis. | ||
| 61A9 | LD H,$00 | |||
| 61AB | ADD HL,HL | |||
| 61AC | AND $01 | |||
| 61AE | JR Z,PathIntersect_9 | |||
| 61B0 | LD (ManData_PosSecondary_dfc5),HL | |||
| 61B3 | RET | |||
| PathIntersect_9 | 61B4 | LD (ManData_PosPrimary_dfc3),HL | ||
| 61B7 | RET | |||
| Prev: 60EF | Up: Map | Next: 61B8 |