Prev: 52162 Up: Map Next: 52421
52337: 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 52337 LD A,(23782) Fetch the view flags and keep them in C.
52340 LD C,A
52341 AND %00000011 Keep the scroll left bits.
52343 JR NZ,ScrollView_Left Jump to ScrollView_Left if the view is already scrolling left.
52345 LD A,(IX+14) Fetch the column of the player on the screen.
52348 CP 115 Jump to ScrollView_Right if the player is not that far to the right.
52350 JR C,ScrollView_Right
52352 LD A,(23782) Fetch the view flags.
52355 AND %11111100 Clear the scroll left bits.
52357 INC A Set them to one pixel a frame.
52358 LD (23782),A Store the view flags.
ScrollView_Left 52361 CALL ScrollViewLeft Scroll the view to the left.
52364 JR ScrollView_Vertical Jump to the vertical scroll.
ScrollView_Right 52366 LD A,C Fetch the view flags kept in C.
52367 AND %00001100 Keep the scroll right bits.
52369 JR NZ,ScrollView_ScrollRight Jump to ScrollView_ScrollRight if the view is already scrolling right.
52371 LD A,(IX+14) Fetch the column of the player on the screen.
52374 CP 50 Jump to ScrollView_Vertical if the player is not that far to the left.
52376 JR NC,ScrollView_Vertical
52378 LD A,C Fetch the view flags kept in C.
52379 AND %11110011 Clear the scroll right bits.
52381 ADD A,4 Set them to one pixel a frame.
52383 LD (23782),A Store the view flags.
ScrollView_ScrollRight 52386 CALL ScrollViewRight Scroll the view to the right.
ScrollView_Vertical 52389 LD A,(23782) Fetch the view flags and keep them in C.
52392 LD C,A
52393 AND %00110000 Keep the scroll down bits.
52395 JP NZ,ScrollViewDown Scroll the view down if it is already scrolling down.
52398 LD A,(IX+15) Fetch the row of the player on the screen.
52401 CP 47 Jump to ScrollViewDown to scroll the view down if the player is near the top of the view.
52403 JP C,ScrollViewDown
52406 LD A,C Fetch the view flags kept in C.
52407 AND %11000000 Keep the scroll up bits.
52409 JP NZ,ScrollViewUp Scroll the view up if it is already scrolling up.
52412 LD A,(IX+15) Fetch the row of the player on the screen.
52415 CP 97 Compare it with 97.
52417 RET C Return if the player is not near the bottom of the view.
52418 JP ScrollViewUp Scroll the view up.
Prev: 52162 Up: Map Next: 52421