Prev: C29A Up: Map Next: C2E8
C2CE: Choose Start Room
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.
Seed 00: room 33 Seed 01: room 5C
choose-start-room-0 choose-start-room-1
Seed 02: room 64 Seed 03: room 0C
choose-start-room-2 choose-start-room-3
Copy the starting record of the legs.
ChooseStartRoom C2CE LD HL,$C3EF Take the original of the record, PlayerTemplate.
C2D1 LD DE,$C3FF Take the copy of the record, PlayerRecords.
C2D4 LD BC,$0010 Set the number of bytes to copy in BC to 10.
C2D7 LDIR Copy the record.
Choose one of the four start rooms.
C2D9 LD A,($A70D) Fetch the random seed from RandomSeed.
C2DC AND %00000011 Keep only two bits of it, which give a number from 00 to 03.
C2DE LD C,A Set the number in C.
C2DF LD HL,$C2E8 Take the table of rooms, StartRooms.
C2E2 ADD HL,BC Add the number to get the address of the room.
C2E3 LD A,(HL) Fetch the room.
C2E4 LD ($C407),A Set it as the room of the copy of the record at PlayerRecords.
C2E7 RET Return.
Prev: C29A Up: Map Next: C2E8