Prev: 35283 Up: Map Next: 35903
35845: Accelerate Object
Adds the acceleration of an object to its speed in both directions, limiting the speed to a maximum which depends on the flags of the object. The speeds are two byte values (see LimitSpeedToRange).
Input
IX Address of the object
AccelerateObject 35845 LD A,(IX+16) Fetch the flags of the object.
35848 AND %00000111 Keep the bottom three bits.
35850 INC A Add one to get the speed limit.
35851 LD (35843),A Store it in 35843.
35854 CPL Negate it...
35855 LD (35844),A ...and store the negative limit in 35844.
35858 LD H,(IX+7) Fetch the horizontal speed of the object into HL.
35861 LD L,(IX+8)
35864 LD D,(IX+11) Fetch the horizontal acceleration into DE.
35867 LD E,(IX+12)
35870 ADD HL,DE Add it to the speed.
35871 CALL LimitSpeedToRange Limit the speed.
35874 LD (IX+7),H Store the new horizontal speed.
35877 LD (IX+8),L
35880 LD H,(IX+9) Fetch the vertical speed of the object into HL.
35883 LD L,(IX+10)
35886 LD D,(IX+14) Fetch the vertical acceleration into DE.
35889 LD E,(IX+15)
35892 ADD HL,DE Add it to the speed.
35893 CALL LimitSpeedToRange Limit the speed.
35896 LD (IX+9),H Store the new vertical speed.
35899 LD (IX+10),L
35902 RET Return.
Prev: 35283 Up: Map Next: 35903