Prev: 25880 Up: Map Next: 25943
25918: Locate Player Marker
Used by the routines at NewGame and FlashPlayerMarker.
Works out where the player's marker belongs on the map in the sidebar, where one pixel is 128 units of the player's position. The marker is at H=71 - the Y position / 128 and L=8 + the X position / 128.
Output
HL Pixel co-ordinates of the marker (H is the Y position and L is the X position)
LocatePlayerMarker 25918 LD DE,(24072) Fetch the player's Y position on the map (PlayerMapPositionY).
25922 SLA E Double it, so that D holds the Y position / 128.
25924 RL D
25926 LD A,71 Start from 71 the bottom of the map.
25928 SUB D Take the Y position away, as the map counts up from the bottom.
25929 LD D,A Keep the Y position of the marker in D.
25930 LD HL,(24069) Fetch the player's X position on the map (PlayerMapPosition).
25933 SLA L Double it, so that H holds the X position / 128.
25935 RL H
25937 LD A,H Fetch the X position / 128.
25938 ADD A,8 Add 8 the X position of the left edge of the map.
25940 LD L,A Set the X position of the marker in L.
25941 LD H,D Set the Y position of the marker in H.
25942 RET Return.
Prev: 25880 Up: Map Next: 25943