Prev: CBC2 Up: Map Next: CCC5
CC71: Scroll View
Used by the routine at RunFrame.
Scrolls the view if the player has moved too close to one of its edges. The view is scrolled to the left or right first, with ScrollViewLeft or ScrollViewRight, and then up or down, with ScrollViewDown or ScrollViewUp.
Input
IX The player entity
ScrollView CC71 LD A,($5CE6) Fetch the view flags and keep them in C.
CC74 LD C,A
CC75 AND %00000011 Keep the scroll left bits.
CC77 JR NZ,ScrollView_Left Jump to ScrollView_Left if the view is already scrolling left.
CC79 LD A,(IX+$0E) Fetch the column of the player on the screen.
CC7C CP $73 Jump to ScrollView_Right if the player is not that far to the right.
CC7E JR C,ScrollView_Right
CC80 LD A,($5CE6) Fetch the view flags.
CC83 AND %11111100 Clear the scroll left bits.
CC85 INC A Set them to one pixel a frame.
CC86 LD ($5CE6),A Store the view flags.
ScrollView_Left CC89 CALL ScrollViewLeft Scroll the view to the left.
CC8C JR ScrollView_Vertical Jump to the vertical scroll.
ScrollView_Right CC8E LD A,C Fetch the view flags kept in C.
CC8F AND %00001100 Keep the scroll right bits.
CC91 JR NZ,ScrollView_ScrollRight Jump to ScrollView_ScrollRight if the view is already scrolling right.
CC93 LD A,(IX+$0E) Fetch the column of the player on the screen.
CC96 CP $32 Jump to ScrollView_Vertical if the player is not that far to the left.
CC98 JR NC,ScrollView_Vertical
CC9A LD A,C Fetch the view flags kept in C.
CC9B AND %11110011 Clear the scroll right bits.
CC9D ADD A,$04 Set them to one pixel a frame.
CC9F LD ($5CE6),A Store the view flags.
ScrollView_ScrollRight CCA2 CALL ScrollViewRight Scroll the view to the right.
ScrollView_Vertical CCA5 LD A,($5CE6) Fetch the view flags and keep them in C.
CCA8 LD C,A
CCA9 AND %00110000 Keep the scroll down bits.
CCAB JP NZ,ScrollViewDown Scroll the view down if it is already scrolling down.
CCAE LD A,(IX+$0F) Fetch the row of the player on the screen.
CCB1 CP $2F Jump to ScrollViewDown to scroll the view down if the player is near the top of the view.
CCB3 JP C,ScrollViewDown
CCB6 LD A,C Fetch the view flags kept in C.
CCB7 AND %11000000 Keep the scroll up bits.
CCB9 JP NZ,ScrollViewUp Scroll the view up if it is already scrolling up.
CCBC LD A,(IX+$0F) Fetch the row of the player on the screen.
CCBF CP $61 Compare it with 61.
CCC1 RET C Return if the player is not near the bottom of the view.
CCC2 JP ScrollViewUp Scroll the view up.
Prev: CBC2 Up: Map Next: CCC5