![]() |
Routines |
| Prev: 51417 | Up: Map | Next: 51517 |
|
Used by the routine at ScrollView.
Scrolls the view to the left when the player has moved towards the right of the view. The buffer is shifted with one of the routines in the table at ShiftLeftTable, the view is moved with AdjustViewOrigin and the objects that have come into view are drawn using DrawRightStrip.
|
||||||||
|
Check whether the player is near enough to the right of the view for the view to scroll to the left. If it is not, stop scrolling.
|
||||||||
| ScrollViewLeft | 51432 | LD A,(23792) | Fetch the scroll position along the view and keep it in C. | |||||
| 51435 | LD C,A | |||||||
| 51436 | LD A,(IX+14) | Fetch the column of the player on the screen and keep it in D. | ||||||
| 51439 | LD D,A | |||||||
| 51440 | CP 104 | Compare it with 104. | ||||||
| 51442 | LD L,252 | Set the bits of the view flags to keep, to clear the scroll bits. | ||||||
| 51444 | JP C,UpdateViewFlags | Jump to UpdateViewFlags if the player is not near the right of the view. | ||||||
|
Choose the speed to scroll at, which is two pixels a frame when the player is near the edge of the view and one pixel a frame otherwise.
|
||||||||
| 51447 | LD E,2 | Set the speed to two pixels. | ||||||
| 51449 | LD A,(23782) | Fetch the view flags. | ||||||
| 51452 | AND %00000011 | Keep the scroll left bits. | ||||||
| 51454 | CP 2 | Jump to ScrollViewLeft_CheckPhase if the view is not already scrolling at two pixels. | ||||||
| 51456 | JR NZ,ScrollViewLeft_CheckPhase | |||||||
| 51458 | LD A,D | Fetch the column of the player. | ||||||
| 51459 | CP 116 | Jump to ScrollViewLeft_OnePixel to slow down to one pixel if the player is not as far across as that. | ||||||
| 51461 | JR C,ScrollViewLeft_OnePixel | |||||||
| 51463 | JR ScrollViewLeft_Scroll | Keep the speed at two pixels. | ||||||
| ScrollViewLeft_CheckPhase | 51465 | LD A,C | Fetch the scroll position. | |||||
| 51466 | AND %00000011 | Keep the low two bits. | ||||||
| 51468 | JR NZ,ScrollViewLeft_OnePixel | Slow down to one pixel if it is part way through a pixel step. | ||||||
| 51470 | LD A,D | Fetch the column of the player. | ||||||
| 51471 | CP 128 | Jump to ScrollViewLeft_Scroll to keep the speed at two pixels if the player is that far across. | ||||||
| 51473 | JR NC,ScrollViewLeft_Scroll | |||||||
| ScrollViewLeft_OnePixel | 51475 | DEC E | Slow down to one pixel. | |||||
| ScrollViewLeft_Scroll | 51476 | PUSH DE | Save the speed. | |||||
|
When the view has scrolled by another sixteen pixels, draw the objects that have come into view along the right edge of the buffer.
|
||||||||
| 51477 | LD HL,58833 | Point HL at the right of the first row of the buffer. | ||||||
| 51480 | LD (23739),HL | Store it as the place to draw to. | ||||||
| 51483 | LD HL,49377 | Point HL at the routine that draws the objects in the right strip. | ||||||
| 51486 | LD A,C | Fetch the scroll position. | ||||||
| 51487 | AND %00001111 | Keep the low four bits. | ||||||
| 51489 | CALL Z,DrawLevelObjects | Draw the objects of the level in the strip if it is a multiple of sixteen. | ||||||
| 51492 | POP DE | Restore the speed. | ||||||
|
Move the view along by the speed and note it in the view flags.
|
||||||||
| 51493 | CALL AdjustViewOrigin | Move the origin of the view. | ||||||
| 51496 | LD A,E | Fetch the speed. | ||||||
| 51497 | SRL A | Halve it. | ||||||
| 51499 | LD E,A | Keep it in E. | ||||||
| 51500 | INC A | Add one, to make the scroll left value of the flags. | ||||||
| 51501 | LD B,A | Copy it into B. | ||||||
| 51502 | LD A,(23782) | Fetch the view flags. | ||||||
| 51505 | AND %11111100 | Clear the scroll left bits. | ||||||
| 51507 | OR B | Set the new scroll left value. | ||||||
| 51508 | LD (23782),A | Store the view flags. | ||||||
| 51511 | LD HL,51651 | Point HL at the table of routines that shift the buffer to the left. | ||||||
| 51514 | JP JumpViaTable_Index | Shift the buffer. | ||||||
| Prev: 51417 | Up: Map | Next: 51517 |