Prev: 25394 Up: Map Next: 25420
25395: Banknote animation table
Used by the routine at 25420. This animation table contains 5 entries of 5 bytes each, which are used to determine how far up, down or to the right the banknote should move next. The algorithm used is as follows:
Step Description
1 Determine which entry to use based on the banknote's height above the ground
2 Generate a random number, R, between 0 and 255
3 Find the index, J, of the first byte in the entry that is greater than R (J=0-4, or 5 if there is no such byte)
4 Increment the banknote's x-coordinate if J<=2, or leave it alone if J>2
5 Increment the banknote's y-coordinate if J=0 or 3, decrement it if J=1 or 4, or leave it alone if J=2 or 5
The first entry is used when the banknote's height above the ground is -1. This can only happen when the banknote is below but adjacent to the sidewalk, having recently moved right from a spot at a height of 0 above the road. The probabilities with which the banknote's x- and y-coordinates will be adjusted are as follows:
x x+1 y-1 y y+1
1/4 3/4 255/256 1/256 0
25395 DEFB 0,192,192,192,255 J will be 1 (with probability 3/4), 4 (63/256) or 5 (1/256)
The next entry is used when the banknote's height above the ground is 0 (i.e. it is on the road or sidewalk).
x x+1 y-1 y y+1
3/16 13/16 7/32 25/32 0
25400 DEFB 0,48,208,208,216 J will be 1 (with probability 3/16), 2 (5/8), 4 (1/32) or 5 (5/32)
The next entry is used when the banknote's height above the ground is 1.
x x+1 y-1 y y+1
3/8 5/8 1/8 15/32 13/32
25405 DEFB 72,88,160,192,208 J will be 0 (with probability 9/32), 1 (1/16), 2 (9/32), 3 (1/8), 4 (1/16) or 5 (3/16)
The next entry is used when the banknote's height above the ground is 2.
x x+1 y-1 y y+1
3/8 5/8 0 1/4 3/4
25410 DEFB 128,128,160,224,224 J will be 0 (with probability 1/2), 2 (1/8), 3 (1/4) or 5 (1/8)
The final entry is used when the banknote's height above the ground is 3. This can only happen when the banknote is above the road, having recently moved right from a spot at a height of 2 above the sidewalk.
x x+1 y-1 y y+1
1/4 3/4 0 1/256 255/256
25415 DEFB 192,192,192,255,255 J will be 0 (with probability 3/4), 3 (63/256) or 5 (1/256)
Prev: 25394 Up: Map Next: 25420