Routines
 Prev: 25812 Up: Map Next: 25843
25815: Make a character go to a random location
Used by command lists 18, 20, 28, 40, 42, 66, 68, 78 and 88 to make a character go to a place at random. The random locations are arranged in eight groups of four. The group of locations that is suitable for a particular character to choose from is determined by byte 36 of the character's buffer.
Input
H Character number (183-209)
25815 LD L,36 Point HL at byte 36 of the character's buffer
25817 LD E,(HL) Pick up the contents in E
25818 EX DE,HL
25819 CALL 25233 A=random number
25822 AND 3 A=211, 212, 213 or 214
25826 LD H,A Point HL at an entry in the table of random locations
25827 LD E,1 Point DE at byte 1 of the character's buffer
25829 LD A,(DE) A=character's x-coordinate
25830 CP (HL) Is the character already at this x-coordinate?
25831 JR Z,25819 Get another random location if so
25833 LD E,5 Copy the random location's coordinates into bytes 5 and 6 of the character's buffer, thus making it his next destination
25835 LDI
25837 LDI
25839 EX DE,HL Transfer the character number back to H
25840 JP 25705 Send the character on his way
The contents of byte 36 of each character's buffer are as follows:
H Character Address Byte
183 Little girl no. 1 46884 36
184 Little girl no. 2 47140 36
185 Little girl no. 3 47396 36
186 Little girl no. 4 47652 38
187 Little girl no. 5 47908 38
188 Little girl no. 6 48164 38
189 Little girl no. 7 48420 38
190 Little boy no. 1 48676 40
191 Little boy no. 2 48932 40
192 Little boy no. 3 49188 40
193 Little boy no. 4 49444 42
194 Little boy no. 5 49700 42
195 Little boy no. 6 49956 42
196 Little boy no. 7 50212 42
197 Little boy no. 8 50468 42
198 Little boy no. 9 50724 44
199 Little boy no. 10 50980 44
200 MR WACKER 51236 48
201 MR WITHIT 51492 48
202 MR ROCKITT 51748 68
203 MR CREAK 52004 68
204 MISS TAKE 52260 38
205 ALBERT 52516 44
206 BOY WANDER 52772 46
207 ANGELFACE 53028 46
208 EINSTEIN 53284 44
209 HAYLEY 53540 36
The eight groups of random locations used by this routine are:
E D=211 D=212 D=213 D=214
36 129,17 144,17 136,17 189,17
38 189,17 189,10 170,17 182,3
40 38,3 10,10 10,17 66,17
42 38,3 10,17 109,17 75,17
44 112,17 145,17 158,17 37,3
46 189,10 183,17 137,17 72,17
48 157,17 38,3 10,17 92,17
68 38,3 90,3 10,17 90,17
 Prev: 25812 Up: Map Next: 25843