![]() |
Routines |
| Prev: 49818 | Up: Map | Next: 49896 |
|
Used by the routine at RunGame.
Makes the copy of the object record of the legs of the player that is used at the start of a life, and chooses at random which of four rooms the player starts in.
|
||||||||||||
|
Copy the starting record of the legs.
|
||||||||||||
| ChooseStartRoom | 49870 | LD HL,50159 | Take the original of the record, PlayerTemplate. | |||||||||
| 49873 | LD DE,50175 | Take the copy of the record, PlayerRecords. | ||||||||||
| 49876 | LD BC,16 | Set the number of bytes to copy in BC to 16. | ||||||||||
| 49879 | LDIR | Copy the record. | ||||||||||
|
Choose one of the four start rooms.
|
||||||||||||
| 49881 | LD A,(42765) | Fetch the random seed from RandomSeed. | ||||||||||
| 49884 | AND %00000011 | Keep only two bits of it, which give a number from 0 to 3. | ||||||||||
| 49886 | LD C,A | Set the number in C. | ||||||||||
| 49887 | LD HL,49896 | Take the table of rooms, StartRooms. | ||||||||||
| 49890 | ADD HL,BC | Add the number to get the address of the room. | ||||||||||
| 49891 | LD A,(HL) | Fetch the room. | ||||||||||
| 49892 | LD (50183),A | Set it as the room of the copy of the record at PlayerRecords. | ||||||||||
| 49895 | RET | Return. | ||||||||||
| Prev: 49818 | Up: Map | Next: 49896 |