![]() |
Routines |
| Prev: 49422 | Up: Map | Next: 49540 |
|
Used by the routine at UpdateStars.
Makes a scroll speed smaller for the stars of a layer further away, by shifting it right once for the second layer and twice for the third. For the third layer, on odd frames, a speed of 254 is first changed to zero and a speed of 2 is changed to 4.
|
||||||||||||||
| ScaleScrollSpeed | 49490 | LD A,B | A=B. | |||||||||||
| 49491 | CP 1 | Return if A is 1. | ||||||||||||
| 49493 | RET Z | |||||||||||||
| 49494 | CP 2 | Jump to ScaleScrollSpeed_Third if A is 2. | ||||||||||||
| 49496 | JR Z,ScaleScrollSpeed_Third | |||||||||||||
| 49498 | LD A,H | A=H. | ||||||||||||
| 49499 | CP 254 | Jump to ScaleScrollSpeed_Third if A is not 254. | ||||||||||||
| 49501 | JR NZ,ScaleScrollSpeed_Third | |||||||||||||
| 49503 | LD A,(39524) | The frame counter. | ||||||||||||
| 49506 | AND %00000001 | Keep the bits of A that are set in 1. | ||||||||||||
| 49508 | JR Z,ScaleScrollSpeed_Third | Jump to ScaleScrollSpeed_Third if the zero flag is set. | ||||||||||||
| 49510 | LD H,0 | Clear H. | ||||||||||||
| 49512 | RET | Return. | ||||||||||||
| ScaleScrollSpeed_Third | 49513 | LD A,B | A=B. | |||||||||||
| 49514 | CP 3 | Jump to ScaleScrollSpeed_Shift if A is not 3. | ||||||||||||
| 49516 | JR NZ,ScaleScrollSpeed_Shift | |||||||||||||
| 49518 | LD A,H | A=H. | ||||||||||||
| 49519 | CP 2 | Jump to ScaleScrollSpeed_Shift if A is not 2. | ||||||||||||
| 49521 | JR NZ,ScaleScrollSpeed_Shift | |||||||||||||
| 49523 | LD A,(39524) | The frame counter. | ||||||||||||
| 49526 | AND %00000001 | Keep the bits of A that are set in 1. | ||||||||||||
| 49528 | JR Z,ScaleScrollSpeed_Shift | Jump to ScaleScrollSpeed_Shift if the zero flag is set. | ||||||||||||
| 49530 | LD H,4 | H=4. | ||||||||||||
| ScaleScrollSpeed_Shift | 49532 | LD A,B | A=B. | |||||||||||
| 49533 | DEC A | Step A back. | ||||||||||||
| ScaleScrollSpeed_Loop | 49534 | SRA H | Shift H right keeping the sign. | |||||||||||
| 49536 | DEC A | Step A back. | ||||||||||||
| 49537 | JR NZ,ScaleScrollSpeed_Loop | Jump to ScaleScrollSpeed_Loop if the zero flag is clear. | ||||||||||||
| 49539 | RET | Return. | ||||||||||||
| Prev: 49422 | Up: Map | Next: 49540 |