Prev: 51805 Up: Map Next: 51870
51821: Initialise Player
Used by the routine at InitialiseGame.
Sets up the copy of the player at the start of the game. The player appears in a room that is picked at random from four rooms.
Copy the sparkle and pick a start room.
InitialisePlayer 51821 LD HL,51805 Point HL at InitialPlayerData.
51824 LD DE,51741 Point DE at PlayerCopy.
51827 LD BC,8 Set BC to 0008.
51830 LDIR Copy the bottom half.
51832 LD DE,51773 Point DE at PlayerCopy_TopHalf.
51835 LD BC,8 Set BC to 0008.
51838 LDIR Copy the top half.
51840 LD A,22 Write 22 to 51757.
51842 LD (51757),A
51845 LD A,38 Write 38 to 51789.
51847 LD (51789),A
51850 LD A,(23296) Fetch RandomSeed1.
51853 AND %00000011 Keep only bits 0 and 1.
51855 LD L,A Copy it to L.
51856 LD H,0 Set H to 0.
51858 LD BC,51870 Point BC at StartRooms.
51861 ADD HL,BC Add BC to HL.
51862 LD A,(HL) Fetch the start room.
51863 LD (51749),A Set 51749.
51866 LD (51781),A Set 51781.
51869 RET Return.
View the equivalent code in;
Prev: 51805 Up: Map Next: 51870