![]() |
Routines |
| Prev: B58B | Up: Map | Next: B5C4 |
|
Gives a sparkle its speeds in X and Y and picks one of its sparkle graphics at random. There are four entry points, one for each combination of the speeds 04 and FC. They load L with the X speed and H with the Y speed and carry on at SetSparkleSpeed_Store.
|
||||||||
| SetSparkleSpeed | B593 | LD HL,$04FC | Set the X speed to FC and the Y speed to 04. | |||||
|
Store the speeds and pick the graphic.
|
||||||||
| SetSparkleSpeed_Store | B596 | LD (IX+$09),L | Store the X speed in the object. | |||||
| B599 | LD (IX+$0A),H | Store the Y speed in the object. | ||||||
| B59C | LD A,($5BA5) | Fetch the second random seed from RandomSeed2. | ||||||
| B59F | AND %00000011 | Keep the lowest two bits to get a random number from 00 to 03. | ||||||
| B5A1 | JR NZ,SetSparkleSpeed_Graphic | Jump to SetSparkleSpeed_Graphic if it is not zero. | ||||||
| B5A3 | INC A | Make zero into one. | ||||||
| SetSparkleSpeed_Graphic | B5A4 | ADD A,$82 | Add 82 to get one of the three sparkle graphic numbers. | |||||
| B5A6 | LD (IX+$00),A | Store it as the graphic number of the object. | ||||||
|
This entry point is used by the routine at SendSparkleAtPlayer.
|
||||||||
| SetSparkleSpeed_Move | B5A9 | LD A,(IX+$03) | Fetch the height of the sparkle. | |||||
| B5AC | LD ($5BC5),A | Store it, so that the sound of rising blocks can use it at SparkleHeight. | ||||||
|
This entry point is used by the routines at HandleBlockMovingEastWest and HandleBlock.
Move the object by its speeds, applying gravity, and flag it to be redrawn.
|
||||||||
| MoveAndDrawObject | B5AF | CALL ApplyGravityAndMove | Update the position of the object. | |||||
| B5B2 | JP SetWipeAndDrawFlags | Flag the object to be wiped and drawn again. | ||||||
| SetSparkleSpeed_PositivePositive | B5B5 | LD HL,$0404 | Set the X speed to 04 and the Y speed to 04. | |||||
| B5B8 | JR SetSparkleSpeed_Store | Jump to SetSparkleSpeed_Store. | ||||||
| SetSparkleSpeed_NegativeNegative | B5BA | LD HL,$FCFC | Set the X speed to FC and the Y speed to FC. | |||||
| B5BD | JR SetSparkleSpeed_Store | Jump to SetSparkleSpeed_Store. | ||||||
| SetSparkleSpeed_NegativePositive | B5BF | LD HL,$FC04 | Set the X speed to 04 and the Y speed to FC. | |||||
| B5C2 | JR SetSparkleSpeed_Store | Jump to SetSparkleSpeed_Store. | ||||||
| Prev: B58B | Up: Map | Next: B5C4 |