Prev: 7EDD Up: Map Next: 7F56
7EED: Background : Draw all of the background.
Input
Output
Draws all of the background, column by column.
The routine re-uses the column draw sub-routines so the players values are used.
Bg_DrawAll 7EED LD HL,(Coords_NS) Set of positions based on direction.
7EF0 LD DE,(Coords_EW)
7EF4 RES 0,L Make even as there are two steps for each column.
7EF6 RES 0,E
7EF8 PUSH HL Store new values for reseting player.
7EF9 PUSH DE
7EFA LD A,(Hero_LastDirection) Determine which coordinate is left to right on the screen and shift to represent the left hand column of the screen.
7EFD PUSH AF
7EFE LD A,$01
7F00 LD (Hero_LastDirection),A
7F03 LD A,(Camera_Compass)
7F06 BIT 0,A North or South coordinates.
7F08 JR NZ,Bg_DrawAll_0
7F0A EX DE,HL Work on East to West coordinates.
Bg_DrawAll_0 7F0B LD BC,$0042 Nort or East. Offset path postion by $42
7F0E BIT 1,A
7F10 JR NZ,Bg_DrawAll_1
7F12 LD BC,$FFBE South or West. Offset path position by -$42
Bg_DrawAll_1 7F15 ADD HL,BC
7F16 BIT 0,A
7F18 JR NZ,Bg_DrawAll_2
7F1A EX DE,HL North or South swap around coordinates again.
Bg_DrawAll_2 7F1B LD (Coords_NS),HL Use the players coordinates to keep track of the column to draw.
7F1E LD (Coords_EW),DE
7F22 LD HL,Offscreen_Bitmap
7F25 LD B,$22 Number of columns to draw.
Draw each column.
Bg_DrawAll_3 7F27 PUSH BC
7F28 PUSH HL
7F29 LD IX,Table_PathOffsets_Right
7F2D CALL Bg_DrawColumn Find and draw the item baed on the position of the column.
7F30 LD HL,(Camera_Compass)
7F33 LD H,$00
7F35 ADD HL,HL
7F36 LD BC,Coords_MoveVector
7F39 ADD HL,BC
7F3A LD E,L
7F3B LD D,H
7F3C CALL JP_HL
7F3F EX DE,HL
7F40 CALL JP_HL
7F43 POP HL
7F44 INC HL
7F45 POP BC
7F46 DJNZ Bg_DrawAll_3
7F48 POP AF
7F49 LD (Hero_LastDirection),A
7F4C POP DE
7F4D POP HL
7F4E LD (Coords_NS),HL Put player position back.
7F51 LD (Coords_EW),DE
7F55 RET
Prev: 7EDD Up: Map Next: 7F56