![]() |
Routines |
| Prev: F1DF | Up: Map | Next: F24F |
|
Used by the routine at GameStart.
Adjust the camera window at Pointer_CameraRoomOrigin to follow the target entity.
|
||||
|
If the camera-follow delay is non-zero, tick it down; otherwise scroll the window toward the target.
|
||||
| Update_CameraFollow | F1F3 | LD A,($730A) | Load A with the camera-follow delay (CameraFollowDelay). | |
| F1F6 | OR A | Is the camera-follow delay (CameraFollowDelay) zero? If so, jump to Update_CameraFollow_Active. | ||
| F1F7 | JR Z,Update_CameraFollow_Active | |||
| F1F9 | DEC A | Decrease A by one. | ||
| F1FA | LD ($730A),A | Set the camera-follow delay (CameraFollowDelay). | ||
| F1FD | RET | Return. | ||
|
Camera delay expired: point at the follow entity (StateData_Berk) and track it against Pointer_CameraRoomOrigin.
|
||||
| Update_CameraFollow_Active | F1FE | LD IX,$909B | Point IX at the camera-follow entity (StateData_Berk). | |
| F202 | LD DE,($72FB) | Load DE with the camera room-origin pointer (Pointer_CameraRoomOrigin). | ||
| F206 | LD B,$20 | Load B with loop count 20. | ||
|
Probe whether the follow entity sits inside the camera X window.
|
||||
| Update_CameraFollow_ProbeX | F208 | LD A,(IX+$07) | Load A with the current entity's x-coordinate. | |
| F20B | ADD A,$02 | A+=02. | ||
| F20D | CP E | Is A less than E? If so, jump to Update_CameraFollow_ScrollLeft. | ||
| F20E | JR C,Update_CameraFollow_ScrollLeft | |||
| F210 | LD C,A | Keep A in C for the next calculation. | ||
| F211 | LD A,D | Copy D into A for later use. | ||
| F212 | CP C | Is A less than C? If so, jump to Update_CameraFollow_ScrollRight. | ||
| F213 | JR C,Update_CameraFollow_ScrollRight | |||
| F215 | RET | Return. | ||
|
Scroll the camera origin right by 20 until the follow entity is centred.
|
||||
| Update_CameraFollow_ScrollRight | F216 | LD A,E | Copy the saved low byte from E into A. | |
| F217 | CP $A0 | Is A equal to A0? If so, jump to Update_CameraFollow_WrapLeft. | ||
| F219 | JR Z,Update_CameraFollow_WrapLeft | |||
| F21B | ADD A,B | A+=B. | ||
| F21C | LD E,A | Copy A into E as a saved coordinate / value. | ||
| F21D | LD D,A | Copy A into D as a saved coordinate / value. | ||
| F21E | ADD A,B | A+=B. | ||
| F21F | LD D,A | Copy A into D as a saved coordinate / value. | ||
| F220 | LD ($72FB),DE | Store DE in Pointer: Camera Room Origin (Pointer_CameraRoomOrigin). | ||
| F224 | JR Update_CameraFollow_ProbeX | Jump to Update_CameraFollow_ProbeX to continue the loop. | ||
|
Wrap the follow entity left by A0 when the camera hits the right edge.
|
||||
| Update_CameraFollow_WrapLeft | F226 | LD A,(IX+$07) | Load A with the current entity's x-coordinate. | |
| F229 | SUB $A0 | A-=A0. | ||
| F22B | LD (IX+$07),A | Set the current entity's x-coordinate. | ||
| F22E | JR Update_CameraFollow_AdjustXExtent | Jump to Update_CameraFollow_AdjustXExtent to refresh the follow entity's x-extent. | ||
|
Scroll the camera origin left by 20 until the follow entity is centred.
|
||||
| Update_CameraFollow_ScrollLeft | F230 | LD A,E | Copy the saved low byte from E into A. | |
| F231 | CP $20 | Is A equal to 20? If so, jump to Update_CameraFollow_WrapRight. | ||
| F233 | JR Z,Update_CameraFollow_WrapRight | |||
| F235 | SUB B | Subtract B from A. | ||
| F236 | LD E,A | Copy A into E as a saved coordinate / value. | ||
| F237 | LD A,D | Copy D into A for later use. | ||
| F238 | SUB B | Subtract B from A. | ||
| F239 | LD D,A | Copy A into D as a saved coordinate / value. | ||
| F23A | LD ($72FB),DE | Store DE in Pointer: Camera Room Origin (Pointer_CameraRoomOrigin). | ||
| F23E | JR Update_CameraFollow_ProbeX | Jump to Update_CameraFollow_ProbeX to continue the loop. | ||
|
Wrap the follow entity right by A0 when the camera hits the left edge.
|
||||
| Update_CameraFollow_WrapRight | F240 | LD A,(IX+$07) | Load A with the current entity's x-coordinate. | |
| F243 | ADD A,$A0 | A+=A0. | ||
| F245 | LD (IX+$07),A | Set the current entity's x-coordinate. | ||
|
Refresh the follow entity's X-extent after a wrap and keep probing.
|
||||
| Update_CameraFollow_AdjustXExtent | F248 | ADD A,$05 | A+=05. | |
| F24A | LD (IX+$08),A | Set the current entity's x-extent. | ||
| F24D | JR Update_CameraFollow_ProbeX | Jump to Update_CameraFollow_ProbeX to continue the loop. | ||
| Prev: F1DF | Up: Map | Next: F24F |