Prev: 46475 Up: Map Next: 46532
46483: Set Sparkle Speed
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 4 and 252. They load L with the X speed and H with the Y speed and carry on at SetSparkleSpeed_Store.
Input
IX Address of the sparkle object
SetSparkleSpeed 46483 LD HL,1276 Set the X speed to 252 and the Y speed to 4.
Store the speeds and pick the graphic.
SetSparkleSpeed_Store 46486 LD (IX+9),L Store the X speed in the object.
46489 LD (IX+10),H Store the Y speed in the object.
46492 LD A,(23461) Fetch the second random seed from RandomSeed2.
46495 AND %00000011 Keep the lowest two bits to get a random number from 0 to 3.
46497 JR NZ,SetSparkleSpeed_Graphic Jump to SetSparkleSpeed_Graphic if it is not zero.
46499 INC A Make zero into one.
SetSparkleSpeed_Graphic 46500 ADD A,130 Add 130 to get one of the three sparkle graphic numbers.
46502 LD (IX+0),A Store it as the graphic number of the object.
This entry point is used by the routine at SendSparkleAtPlayer.
SetSparkleSpeed_Move 46505 LD A,(IX+3) Fetch the height of the sparkle.
46508 LD (23493),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 46511 CALL ApplyGravityAndMove Update the position of the object.
46514 JP SetWipeAndDrawFlags Flag the object to be wiped and drawn again.
SetSparkleSpeed_PositivePositive 46517 LD HL,1028 Set the X speed to 4 and the Y speed to 4.
46520 JR SetSparkleSpeed_Store Jump to SetSparkleSpeed_Store.
SetSparkleSpeed_NegativeNegative 46522 LD HL,64764 Set the X speed to 252 and the Y speed to 252.
46525 JR SetSparkleSpeed_Store Jump to SetSparkleSpeed_Store.
SetSparkleSpeed_NegativePositive 46527 LD HL,64516 Set the X speed to 4 and the Y speed to 252.
46530 JR SetSparkleSpeed_Store Jump to SetSparkleSpeed_Store.
Prev: 46475 Up: Map Next: 46532